麻烦帮助解释一下,对它不太熟悉
这段代码要达到的目的是:当鼠标在文字上面时,文字下面出现下拉菜单。
CSS code:
li:hover ul, li.over ul { //[color=#FF6600] ?这是什么意思[/color]
display: block; //我知道这是显示块信息
}
JScript code:
<script type="text/javascript"><!--//--><![CDATA[//><!--
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over"; // [color=#FF9900]?这是什么意思[/color] }
node.onmouseout=function() {
this.className=this.className.replace(" over", ""); // [color=#FF0000]这是什么意思[/color] }
}
}
}
}
window.onload=startList;
//--><!]]></script>
就是改变样式吧
this.className+=" over"; 等价于 this.className=this.className+" over";
给className连接字符串“ over”
1.看到《精通javascript》上说:javascript是完全异步的,那么是不是每条语句都不会执行完,下条语句就开始执行呢,实际上不是这样,也不可能是这样,不然怎么写程序?
2.代码如下,为什么不可行呢:
JScript ......
$("p:first").before(" <center> <button id=\"button1\" onClick=\"cut()\">剪切 </button> <button id=\"button2\">复制 <\/button> ......