求一段JavaScript的注释!!
刚开始学习,哪位大虾帮忙添加个详细的注释啊,最好逐行添加!!! <script language="JavaScript1.2"> scores = new Array(20); var numTotal=0; NS4 = ( yers) ? 1 : 0; IE4 = ( l) ? 1 : 0; ver4 = (NS4 || IE4) ? 1 : 0; if (ver4) { with (document) { write("<STYLE TYPE='text/css'>"); if (NS4) { write(".parent { v }"); write(".child { v }"); write(".regular { v }") } else { write(".child { }") } write("</STYLE>"); } } function getIndex(el) { ind = null; for (i=0; i< yers.length; i++) { whichEl = yers[i]; if ( == el) { ind = i; break; } } return ind; } function arrange() { nextY = yers[firstInd].pageY + yers[firstInd].document.height; for (i=firstInd+1; i< yers.length; i++) { whichEl = yers[i]; if ( sibility != "hide") { geY = nextY; nextY += cument.height; } } } function initIt(){ if (!ver4) return; if (NS4) { for (i=0; i< yers.length; i++) { whichEl = yers[i]; if ( dexOf("Child") != -1) sibility = "hide"; } arrange(); } else { divColl = l.tags("DIV"); for (i=0; i<divColl.length; i++) { whichEl = divColl(i); if ( assName == "child") yle.display = "none"; } } } function expandIt(el) { if (!ver4) return; if (IE4) { whichEl1 = eval(el + "Child"); for(i=1;i<=numTotal;i++){ whichEl = eval(scores[i] + "Child"); if(whichEl!=whichEl1) { yle.display = "none"; } } whichEl1 = eval(el + "Child"); if ( yle.display == "none") { yle.display = "block"; } else { yle.display = "none"; } } else { whichEl = eval("document." + el + "Child"); for(i=1;i<=numTotal;i++){ whichEl = eval("document." + scores[i] + "Child"); if(whichEl!=whichEl1) { sibility = "hide"; } } if ( sibility == "hide") { sibility = "show"; } else { sibility = "hide"; } arrange(); } } onload = initIt; </script>
呵呵,分越来越高了! 注释好的文件见附件, //这么长! -_- scores = new Array(20); //定义scores数组,包含20个元素 var numTotal=0; //定义numTotal变量,初始值为0 NS4 = ( yers) ? 1 : 0; //这是一个三元表达式,如果 yers可以执行,则变量NS4的值为1,否则为0, IE4 = ( l) ? 1 : 0; //意思同上,至于 yers和 l可以到百度上搜,这些一般用来判断浏览器类型 ver4 = (NS4 || IE4) ? 1 : 0; //如果变量NS4和IE4有一个值为1(为1即为真),则变量ver4值为1,意思是如果浏览器为NetScape或IE则ver4为1 if (ver4) //如果ver4为1,则 { with (document) //with(document)表示后面{}里的所有都是document的方法(相信你应该知道document。
write),如果不用with那么下面的所有write()都要改成document。write() { write(""); //在页面上输出"",这个是html的style标签, if (NS4) //如果NS4为1,则 { write("。
parent {position:absolute; visibility:visible}"); //在页面上输出内容,在Css里 。parent表示parent是一个css类,它的定位方式是绝对定位,可见性为可见 write("。
child {position:absolute; visibility:visible}"); //同上 write("。regular {position:absolute; visibility:visible}") //同上 } else //如果NS4不为1,那么推理一下,程序能够运行到这一步,就肯定是IE4这个变量值为1 { write("。
child {display:none}") //css类child,它的显示为空,即不显示,且不占位 } write(""); //输出,结束style标签 } } function getIndex(el) //定义函数getIndex(),并传递形参el { ind = null; //ind初值为null for (i=0; i Layer 对于广大Photoshop 用户来说,可算是个法宝,然而在Web页面的设计上,使用Layer的却很少。
Layer 可将页面的内容引入“层”的概念,增强了网页的处理能力。Layer 用法形如: 〈Layer name ="nametext" top =20 left =20 width =400 clip =0,0,400,200 bgcolor =red visibility ="show" 〉 〈!-- 此处可加上任意合乎页面规则的内容//--〉 〈/Layer〉 Layer是Netscape 实现动态页面的方法之一,Netscape Navigator 4。
0以上支持此功能。 Layer作为页面上的一个对象具有如下属性和方法: Name 给出Layer的名字,便于Javascript对Layer的控制;Top、Left决定了Layer左上角在页面或其它Layer上的位置;PageX、PageY 决定了 Layer左上角在页面上的位置,它和Top、Left稍有区别;Width决定Layer的宽度;Clip决定Layer显示的区域,有x、y 或x1、y1、x2、y2两种赋值法,x、y相当于0、0、x2、y2;Bgcolor 决定Layer的背景颜色;Visibility有三个值,show和hide决定了Layer是否可见,inherit 决定Layer继承父Layer的Visibility的属性;Background决定了Layer的背景图片;Src 使得Layer可以显示其它页面。
以上的属性可以通过Javascript动态改变,产生各种效果。 Layer还有以下方法: MoveBy(dx, dy) 将Layer从当前位置向左移dx,向下移dy;MoveTo(x, y) 将Layer从当前位置移动到x、y 处,x、y为相对于页面或Layer的左上角的位置;MoveToAbsolute(x, y)将Layer从当前位置移动到x、y 处,x、y为相对于页面左上角的位置;ResizeBy(dwidth, dheight) 和ResizeTo(width, height)将重新设置Layer的显示区域;MoveAbove(layer)、MoveBelow(layer)两个方法可调整 Layer在Layer序列中的位置,但不改变Layer在页面或Layer上的水平和垂直位置。
Load(sourcestring, width) 相当于改变Src的值。
4 //定义script语言,语言类型为JavaScript1。2 scores = new Array(20); //定义一个有20个元素的数组scores var numTotal=0; //定义一个名为numTotal的变量,初值为0 NS4 = ( yers) ? 1 : 0; //如果语言支持 yers,则变量NS4为1,否则为0 IE4 = ( l) ? 1 : 0; //如果支持 l,则变量IE4为1,否则为0 ver4 = (NS4 || IE4) ? 1 : 0; //NS4和IE4中有一个为1的话,则ver4为1,否则为0 //以上三行代码的实际作用就是判断一下用户浏览器的版本是不是4或4以上 if (ver4) { //如果ver4为1 with (document) { //以document对象为基础,即在该大括号中的所有属性和方法都是document对象的,如下面的write相当于document。
write write(""); //在源文件中输出 if (NS4) { //如果NS4为1 write("。parent { v }"); //输出。parent { v } write("。child { v }"); //输出。
child { v } write("。regular { v }") //输出。regular { v } } else { //否则,即如果NS4不为1 write("。child { }") //输出。
child { } } write(""); //输出 } } //上面这段IF语句,其作用为根据用户浏览器对语言的支持,输出一些CSS属性 function getIndex(el) { //定义函数 ind = null; //定义变量ind,初值为空 for (i=0; i // 。
我晕+_+,这么长啊!! 在下无能为力!建议用电子词典(网上COPY一下)
什么问题啊没看明白
答:你是看不懂英文,要人翻译一下吧__程序已经有注释了! 不懂,可以找我!详情>>
答:哪那么麻烦 会dreamweaver/frontpage就可以了 3D,clowdrow我两年都没用过了详情>>
答:做漂亮是网页方面的问题了 要是做动态的话要会程序懂语言才好写 动态的网站的话就是具有一定的交互功能 可以让网友与站点管理人员进行一定程度的交流的 比如会员系统产...详情>>