var otest = document.getElementById("test");
var newcode=document.createElement("li");
newcode.innerHTML="PHP";
otest.insertBefore(newcode,otest.childNodes[1]);
var newcode=document.createElement("li");
newcode.innerHTML="PHP";
otest.insertBefore(newcode,otest.childNodes[1]);
2015-02-14
document.write(myarr1+"<br/>");
document.write(myarr1.reverse());
document.write(myarr1.reverse());
2015-02-13
document.write(Math.round(Math.random()*10));这是利用随机取一个不大于10的数,在进行四舍五入取整
2015-02-13
已采纳回答 / 皓腕凝霜雪
方便使用,是将功能进行封装的思想体现。例如本题,设置元素选中和未选中的两种样式,在JS中只需要修改className就可以同时改变多种属性,若使用setAttribute则需要多行代码来实现。若在JS中需要使用多次,也只需一行代码就可进行复用。(个人认为类似将功能封装到函数的思想)
2015-02-13
最新回答 / qwerasdfvvv
num初始值是0啊 你把num改为获取文本框内的值就可以了 num = document.getElementById("count).value;
2015-02-13