我想知道是否有人可以在我的代码中看到任何内容,我对此非常陌生并且遇到很多麻烦。这是我班上的课程。它应该根据时间说早上/下午,并显示时间。继承人的代码;
fibs :: [Int]
fibs = map fst $ iterate next (1,1)
where
next (n,n') = (n',n+n')
fib :: Int -> Int
fib k = fibs !! k
W3c验证器令人困惑,但我说有2个警告......
错误第43行,第36列:元素“P”的结束标记未打开
<html>
<head>
<title>"Welcome"</title>
<script type="text/javascript">
/* <![CDATA[ */
var dateObject = new Date();
var greeting = " ";
var curTime = " ";
var minuteValue = dateObject.getMinutes();
var hourValue = dateObject.getHours();
if (minuteValue < 10)
minuteValue = "0" + minuteValue;
if (hourValue < 12) {
greeting = "<p>Good morning! "
curTime = hourValue + ":" + minuteValue + " AM";
} else if (hourValue == 12) {
greeting = "<p>Good afternoon!";
curTime = hourValue + ":" + minuteValue + " PM";
} else if (hourValue<17) {
greeting = "<p>Good afternoon! "
curTime = (hourValue-12) + ":" + minuteValue + " PM"
} else {
greeting = "<p>Good evening! "
curTime = (hourValue-12) + ":" + minuteValue + " PM"
}
var dayArray = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");
var monthArray = new Array("January", "February"
"March, "April", "May", "June", "July", "August",
"September", "October", "November", "December");
var day = dateObject.getDay();
var Month = dateObject.getMonth();
document.write("<p>" + greeting + "It is" + curTime
+ "on" + dayArray[day] + "," + monthArray[month]
+ "" + dateObject.getDate() + ","
+ dateObject.getFullYear() + ".</p>");
/* ]]> */
</script>
</head>
<body>
<form>
<h1>Welcome to my Web page</h1>
</form>
</body>
</html>
和
第48行,第6列:未指定必需属性“ACTION”
+ dateObject.getFullYear() + ".</p>");
答案 0 :(得分:0)
我在“二月”之后错过了一个逗号,并在三月之后错过了一个引号。
变量Month
应为month
(小写m)以与后续代码对应。
然后使用"It is "
," on "
和", "
代替"It is"
"on"
和","
(添加空格)我得到以下内容结果,看起来不错:
早上好!现在是2015年9月6日星期日上午11:15。
请注意,由于您要写入已有标题的文档,因此日期会显示之前标题,这可能是您想要的,也可能不是。您可以在某处添加span或div并在那里写,但这超出了您的问题的范围。
这也适合你吗?