文档类型不允许元素“脚本”在这里;假设缺少“body”开始标记

时间:2011-07-20 13:43:50

标签: javascript html validation

验证后我收到此错误:

document type does not allow element "script" here; assuming missing "body" start-tag

以下是代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Feltöltött képek</title>
<!--getDyn       --><script type="text/javascript" src="js/my_js.js"></script>
<!--jQuery ERROR HERE--><script type="text/javascript" src="src/jquery/jquery.js"></script>
<!--inFieldLabel --><script type="text/javascript" src="js/jquery.infieldlabel.min.js"></script>
<!--Facebox      --><script type="text/javascript" src="src/facebox/facebox.js"></script>
<!--Modernizr    --><script type="text/javascript" src="js/modernizr-2.0.6.js"></script>
<script type="text/javascript" src="src/swfupload/swfupload.js"></script>
<script type="text/javascript" src="src/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="src/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="src/swfupload/handlers.js"></script>
<!--IE plugins--><script type="text/javascript" src="js/plugins.js"></script>
<!--cssReset     --><link href="css/reset.css" rel="stylesheet" type="text/css"/>    
<!--cssAll       --><link href="css/all.css" rel="stylesheet" type="text/css"/>
<!--cssFacebox   --><link href="css/facebox.css" rel="stylesheet" type="text/css"/>

<!--<link rel="stylesheet" type="text/css" href="css/index_tabla.css" />-->

<style type="text/css">...</style>
<script type="text/javascript">...</script>
</head>
<body  style="zoom:1; overflow:auto; min-width: 1058px;">...</body>

你能告诉我怎么解决这个问题吗? 谢谢!

更新: 我忘了,验证器无法登录。-.-“ 这是经过测试的来源:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>You have to login to contiune!</title>
</head>
<script type="text/javascript" src="src/jquery/jquery.js"></script>
<body>
<h1>You have to login to contiune!</h1>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

在您的第二段代码中,您的<script>标记既不在<head>也不在<body>。 尝试:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>You have to login to contiune!</title>
<script type="text/javascript" src="src/jquery/jquery.js"></script>
</head>
<body>
<h1>You have to login to contiune!</h1>
</body>
</html>