window.onload=function(){
for(var i=0;i<100;i++)
{
var em=document.createElement('span');
em.id="snow";
em.innerText="*";
document.body.appendChild(em);
snow(em);
}
}
function snow(obj){
var speedY=Math.random()*3+2;
var speedX=4-speedY;
var w=document.body.clientWidth-obj.offsetWidth;
var h=document.body.clientHeight-obj.offsetHeight;
var otop=obj.style.top;
var oleft=obj.style.left;
otop=speedY+'px'; //不报错
obj.style.top=speedY+‘px’; //报错
为什么呢????????
相关分类