var myweek =8;//myweek表示星期几变量
switch (myweek)
{
case 1:
case 2:
document.write("学习理念知识");
break;
case 3:
case 4:
document.write("到企业实践");
break;
case 5:
document.write("总结经验");
break;
case 6:
document.write("周六、日休息和娱乐");
break;
default:
document.write('what?')
}
switch (myweek)
{
case 1:
case 2:
document.write("学习理念知识");
break;
case 3:
case 4:
document.write("到企业实践");
break;
case 5:
document.write("总结经验");
break;
case 6:
document.write("周六、日休息和娱乐");
break;
default:
document.write('what?')
}
2015-05-27
var myH=document.getElementsByTagName("li");
for(var i=0;i<myH.length;i++)
{
document.write("节点名:"+myH[i].nodeName+"<br />");
document.write("节点值:"+myH[i].nodeValue+"<br />");
document.write("节点类型:"+myH[i].nodeType+"<br />");
}
for(var i=0;i<myH.length;i++)
{
document.write("节点名:"+myH[i].nodeName+"<br />");
document.write("节点值:"+myH[i].nodeValue+"<br />");
document.write("节点类型:"+myH[i].nodeType+"<br />");
}
var qw=document.getElementsByTagName('div')[0].childNodes
for(var i=0;i<qw.length;i++)
getCN(qw[i])
function getCN(x){
document.write('节点名称:'+x.nodeName+'<br/>'+'节点类型:'+x.nodeType+'<br/>'+'子节点个数:'+x.childNodes.length+'<br/><br/>')
}
for(var i=0;i<qw.length;i++)
getCN(qw[i])
function getCN(x){
document.write('节点名称:'+x.nodeName+'<br/>'+'节点类型:'+x.nodeType+'<br/>'+'子节点个数:'+x.childNodes.length+'<br/><br/>')
}
2015-05-27
12行 setTimeout("startCount()",1000);
14行 window.onload=startCount;
14行直接startCount会报错,因为那会页面input还没有加载,所以document.getElementById('count')根本不存在;加上window.onload就没问题了
14行 window.onload=startCount;
14行直接startCount会报错,因为那会页面input还没有加载,所以document.getElementById('count')根本不存在;加上window.onload就没问题了
2015-05-27
<script type="text/javascript">
document.write(Math.round(3.3)+"<br/>")
document.write(Math.round(-0.1)+"<br/>")
document.write(Math.round(-9.9)+"<br/>")
document.write(Math.round(8.9)+"<br/>")
</script>
document.write(Math.round(3.3)+"<br/>")
document.write(Math.round(-0.1)+"<br/>")
document.write(Math.round(-9.9)+"<br/>")
document.write(Math.round(8.9)+"<br/>")
</script>
2015-05-27
<script type="text/javascript">
document.write(Math.floor(3.3)+"<br/>")
document.write(Math.floor(-0.1)+"<br/>")
document.write(Math.floor(-9.9)+"<br/>")
document.write(Math.floor(8.9)+"<br/>")
</script>
document.write(Math.floor(3.3)+"<br/>")
document.write(Math.floor(-0.1)+"<br/>")
document.write(Math.floor(-9.9)+"<br/>")
document.write(Math.floor(8.9)+"<br/>")
</script>
2015-05-27
<script type="text/javascript">
var mystr="Hello World!"
document.write(mystr.substring(6)+ "<br />");
document.write( mystr.substring(0,5));
</script>
var mystr="Hello World!"
document.write(mystr.substring(6)+ "<br />");
document.write( mystr.substring(0,5));
</script>
2015-05-27
已采纳回答 / 成者并非一蹴而就
不建议使用document.body.....因为很多了浏览器不认账作用就是获取body里面的元素....也就是文档主体..获取元素最好用document.getElementXXXX
2015-05-27
最赞回答 / 文苏
oldnode.parentNode.replaceChild(newnode,oldnode);var parentNode = oldnode.parentNode; // 获取将被替换节点(旧节点)的父节点parentNode.replaceChild(newnode,oldnode); //(在parentNode这个节点中)将其中旧节点替换为新节点
2015-05-27