[問題] document type does not allow element …
寫了一段小程式,然後用http://validator.w3.org/去作驗證,
出現「document type does not allow element "SCRIPT" here.」這個錯誤,
因為我用了一段script將資料填入table內。
想請問各位先進,這個問題是因為我的DOCTYPE不對呢?
或者是應該用其他方式將資料填入table內呢?
感謝各位看完我的問題。
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"" rel="nofollow">http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<script language="javascript" type="text/javascript"><!--
function displayData()
{
document.write('<tr>');
document.write('<td>AAA<\/td>');
document.write('<td>123456<\/td>');
document.write('<\/tr>');
}
// --></script>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>ID</th>
</tr>
<script type="text/javascript"><!--
displayData();
// --></script>
</table>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.250.164.201
※ 編輯: ZC 來自: 60.250.164.201 (10/09 13:53)
→
10/09 15:07, , 1F
10/09 15:07, 1F
→
10/09 15:08, , 2F
10/09 15:08, 2F
→
10/09 15:08, , 3F
10/09 15:08, 3F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章