问过很多人,仍不得其解。
下列代码,本人有若干不明之处:
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<!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 runat= "server ">
<title> 文字滚动显示 </title>
</head>
<body>
<script language= "JavaScript1.2 ">
//设置marquee显示内容,使用标准的HTML语法。
var text= ' <strong> <big> 欢迎光临 <a href= "http://www.mingrisoft.com "> 明日科技 </a> 图书网 </big> </strong> </font> '
if (document.all)
document.write( ' <marquee scrollAmount= '+6+ ' style= "width: '+500+ ' "> '+text+ ' </marquee> ')
function a()
{
window.location.reload()
}
function b()
{
if (document.layers)
{
setTimeout( "window.onresize=a ",450)
c()
}
}
function c()
{
document.cmarquee01.document.cmarquee02.document.write( ' <nobr> '+text+ ' </nobr> ')
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.width
d()
}
function d()
{
if (document.cmarquee01.document.cmarquee02.left> =thelength*(-1))
{
document.cmarquee01.document.cmarquee02.left-=6
setTimeout( "d() ",100)
}
else
{
document.cmarquee01.document.cmarquee02.left=500
d()
}
}
window.onload=b
</script>
<ilayer width=&{500}; height=&{30}; name= "cmarquee01 ">
<layer name= "cmarquee02 "> </layer>
</ilayer>
</body>
</html>
1.如何理解程序中类似于 document.cmarquee01.document.cmarquee02.document.write( ' <nobr> '+text+ ' </nobr> ')这样的句子?
2.是否可以去掉function a()?(经由本人注释掉,仍可以不间断运行)
3.解释一下layer和ilayer
4.解释下面语句中引号的使用(为什么一定是这样的括法?),document.write( ' <marquee scrollAmount= '+6+ ' style= "width: '+500+ ' "> '+text+ ' </marquee> ')
------解决方案--------------------1.如何理解程序中类似于 document.cmarquee01.document.cmarquee02.document.write( ' <nobr> '+tex