1

我在脚本标签中使用嵌入的 javascript 函数 disableReturnDate() 编写了以下 html 代码。但是在关闭标签上给出了一个错误

*错误*

Multiple annotations found at this line:
  - End tag (</script>) not closed properly, expected >.
  - Unknown tag (script function addReturnDate() { if (document.getElementById('RoundTrip').checked) 
   { document.write("Select Return Date:"); document.write("<script>DateInput('returndate',true,'DD-MON-YYYY');"); 
   document.write("<input type=\"button\" onClick=\"alert(this.form.returndate.value)\" value=\"Show date value 
   passed\">"); } } </script> ).
  - End tag of element <script>

*代码*

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Enter Date-Time, Arrival and Departure Location</title>
<script type="text/javascript" src="calendarDateInput.js"></script>
<script type="text/javascript">
function disableReturnDate() {
    this.form1.returndate.disabled=true;
}
</script>
</head>
<body onload="disableReturnDate()">
<form name="form1" method="post" action="retrievePossibleRoutes.jsp">
Select Travel Date:  
<script>DateInput('traveldate',true,'DD-MON-YYYY');</script> 
<input type="button" onClick="alert(this.form.traveldate.value)" value="Show date value passed">
<br>
Select Return Date:  
<script>DateInput('returndate',true,'DD-MON-YYYY');</script> 
<input type="button" onClick="alert(this.form.returndate.value)" value="Show date value passed">
<input type="radio" name="journeyType" id="OneWay" onClick="disableReturnDate()" checked>One Way<br>
<input type="radio" name="journeyType" id="RoundTrip" onClick="enableReturnDate()">Round Trip<br> 
<br>
Select Departure Location:
<select name="comboDep">
<option></option>
<option></option>
</select>
<input type="submit"/>
<br>
Select Arrival Location:
<select name="comboArrv">
<option></option>
<option></option>
</select>
<input type="submit"/>
</form>
</body>
</html>

知道有什么问题。错误中显示的代码是以前编写的,但我现在已经删除了它,它仍然显示在错误消息中。期待回复

PS 到 calendarDateInput.js 的链接是http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm

4

2 回答 2

3

You can verify HTML by using the W3C validator: http://validator.w3.org/check

Two errors of significance show up. Put

<!doctype html>

at the start of the HTML (you can specify more info in the doctype tag, so look into this a bit more), and add make sure that all tags have the type attribute set:

<script type="text/javascript">
于 2012-04-22T20:10:09.343 回答
2

错误中显示的代码是以前编写的,但我现在已经删除了它,它仍然显示在错误消息中

这意味着您的浏览器已缓存旧版本。清除缓存并重试。

于 2012-04-22T20:17:28.290 回答