要实现的功能是:进入页面后键入姓名留言,当单击“点此查看留言”时显示在当前时间的留言内容。我发现没有达到预想的结果,请大神们帮忙更正一下错误
<html>
<head>
<script type="text/javascript">
function sayHi(sName)
{
alert("Hello," + sName + ",你的留言已成功保存!");
}
function now(sName,sMessage,a)
{
return(sName+"在"+a+"说道:"+sMessage)
}
</script>
</head> <body>
<script type="text/javascript">
var sName=window.prompt("留言","输入姓名")
var sMessage=window.prompt("留言","输入留言")
sayHi(sName);
var today=new Date()
var p=today.getday()
var b=today.gethours()
var m=today.getminutes()
var a=p+"天"+b+":"+m </script>
<a onclick="now(sName,sMessage,a)">点此查看留言</a>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function sayHi(sName)
{
alert("Hello," + sName + ",你的留言已成功保存!");
}
function now(sName,sMessage,a)
{
return(sName+"在"+a+"说道:"+sMessage)
}
</script>
</head> <body>
<script type="text/javascript">
var sName=window.prompt("留言","输入姓名")
var sMessage=window.prompt("留言","输入留言")
sayHi(sName);
var today=new Date()
var p=today.getday()
var b=today.gethours()
var m=today.getminutes()
var a=p+"天"+b+":"+m </script>
<a onclick="now(sName,sMessage,a)">点此查看留言</a>
</body>
</html>