这段JS的问题到底出在哪里?
时间:2010-09-27
来源:互联网
<!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> <title>图片和背景同时切换</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta content="all" name="robots"/> <meta name="generator" content="editplus,firework"/> <meta name="author" content=""/> <meta name="copyright" content=""/> <meta name="keywords" content=""/> <meta name="description" content=""/> <meta http-equiv="pragma" content="no-cache"/> <style type="text/css"> <!-- #picc { width: 500px; height: 306px; float: left; background: #FFFFFF; overflow: hidden; } .ad3right { float: left; width: 398px; height: 204px; border: 1px solid #009900; overflow: hidden; } .ad3right1 { float: left; width: 398px; height: 18px; position: relative; bottom: 23px; left: 0; filter: alpha(opacity=70); } #biaoshi { padding: 0; margin: 0; list-style-type: none; width: 398px; position: relative; bottom: 0; left: 225px; float: left; display: inline; } #biaoshi li { float: left; height: 16px; width: 22px; line-height: 16px; margin-left: 10px; text-align: center; display: inline; background: #000000; border: 1px solid #FF0000; color: #FFFFFF; cursor: hand; } .ad3right2 { float: left; width: 398px; height: 204px; } #pic { padding: 0; margin: 0; list-style-type: none; } .picimg { float: left; width: 398px; height: 204px; overflow: hidden; } .picimg img { display: block; width: 398px; border: none; } #biaoshi #show { background: #330000; border: 1px solid #000000; color: #FF0000; } --> </style> </head> <body> <script language="javascript" type="text/javascript" > function cha(n){ nowN=n; clearTimeout(timer); docha(n) timer=setTimeout(nextPic,stopTime*2); } function docha(n){ for(i=0;i<biaoshi.childNodes.length;i++) biaoshi.childNodes[i].id=""; biaoshi.childNodes[n].id="show"; for(i=0;i<pic.childNodes.length;i++){ pic.childNodes[n].style.filter="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1,wipestyle=2,motion=forward)"; pic.childNodes[n].filters[0].Apply(); pic.childNodes[i].style.display="none"; pic.childNodes[n].filters[0].Play(); } pic.childNodes[n].style.filter="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1,wipestyle=2,motion=forward)"; pic.childNodes[n].filters[0].Apply(); pic.childNodes[n].style.display="block"; pic.childNodes[n].filters[0].Play(); picc.style.backgroundImage="url("+pic.childNodes[n].childNodes[0].childNodes[0].title+")"; } var nowN=-1,timer=null; //停滞3000毫秒 var stopTime=3000; function nextPic(){ clearTimeout(timer); nowN++; if (nowN>4)nowN=0; docha(nowN); timer=setTimeout(nextPic,stopTime); } onload=nextPic </script> <div id="picc"> <div class="ad3right"> <ul id="pic"> <li class="picimg"><a href="#"><img class="pic1" src="http://en.kenon.cn/test/ad/indexAD_1.jpg" title="http://en.kenon.cn/test/ad/indexAD_2.jpg" alt="http://en.kenon.cn/test/ad/indexAD_2.jpg" /></a></li> <li class="picimg"><a href="#"><img class="pic1" src="http://en.kenon.cn/test/ad/indexAD_2.jpg" title="http://en.kenon.cn/test/ad/indexAD_3.jpg" alt="http://en.kenon.cn/test/ad/indexAD_3.jpg" /></a></li> <li class="picimg"><a href="#"><img class="pic1" src="http://en.kenon.cn/test/ad/indexAD_3.jpg" title="http://en.kenon.cn/test/ad/indexAD_4.jpg" alt="http://en.kenon.cn/test/ad/indexAD_4.jpg" /></a></li> <li class="picimg"><a href="#"><img class="pic1" src="http://en.kenon.cn/test/ad/indexAD_4.jpg" title="http://en.kenon.cn/test/ad/indexAD_5.jpg" alt="http://en.kenon.cn/test/ad/indexAD_5.jpg" /></a></li> <li class="picimg"><a href="#"><img class="pic1" src="http://en.kenon.cn/test/ad/indexAD_5.jpg" title="http://en.kenon.cn/test/ad/indexAD_1.jpg" alt="http://en.kenon.cn/test/ad/indexAD_1.jpg" /></a></li> </ul> <div class="ad3right1"> <ul id="biaoshi"> <li onmouseover="cha(0)">1</li> <li onmouseover="cha(1)">2</li> <li onmouseover="cha(2)">3</li> <li onmouseover="cha(3)">4</li> <li onmouseover="cha(4)">5</li> </ul> </div> </div> </div> </body></html>
提示:您可以先修改部分代码再运行
这段代码无法通过W3C认证,提示如下:提示:您可以先修改部分代码再运行
【1】Line 102, Column 38: character ";" not allowed in attribute specification list
for(i=0;i<biaoshi.childNodes.length;i++)✉
【2】Line 102, Column 38: element "biaoshi.childNodes.length" undefined
for(i=0;i<biaoshi.childNodes.length;i++)✉
You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
•incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
•by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
•by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
【3】Line 105, Column 34: character ";" not allowed in attribute specification list
for(i=0;i<pic.childNodes.length;i++){✉
【4】 Line 105, Column 34: element "pic.childNodes.length" undefined
for(i=0;i<pic.childNodes.length;i++){✉
You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
•incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
•by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
•by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
【5】Line 128, Column 9: end tag for "pic.childNodes.length" omitted, but OMITTAG NO was specified
</script>✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
【6】Line 105, Column 12: start tag was here
for(i=0;i<pic.childNodes.length;i++){ Line 128, Column 9: end tag for "biaoshi.childNodes.length" omitted, but OMITTAG NO was specified
</script>✉
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
【7】Line 102, Column 12: start tag was here
for(i=0;i<biaoshi.childNodes.length;i++)
[ 本帖最后由 cgbugs 于 2010-9-27 10:42 编辑 ]
作者: cgbugs 发布时间: 2010-09-27
不是都告诉你了吗,for(i=0;i<biaoshi.childNodes.length;i++)后面的“{”没有吧。
作者: zhaoyan860222 发布时间: 2010-09-27
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28