function replaceMessage(){
var onode=document.getElementById("oldnode")
var oldc=onode.innerHTML;
var cc=document.createElement("i")
var tt=document.createTextNode(oldc);
cc.appendChild(tt);
onode.parentNode.replaceChild(cc,onode)
}
var onode=document.getElementById("oldnode")
var oldc=onode.innerHTML;
var cc=document.createElement("i")
var tt=document.createTextNode(oldc);
cc.appendChild(tt);
onode.parentNode.replaceChild(cc,onode)
}
2015-05-27
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