我想要做到一个效果,在我的window.onload=function({
...
}
方法中,我主动调用一个tr上的onmouseover事件,这个事件会对一个element元素进行操作,添加2个新的element元素进去我想等到这两个element创建结束再继续进行后续操作,可是,每次都是执行时element还没生成。
...
}
方法中,我主动调用一个tr上的onmouseover事件,这个事件会对一个element元素进行操作,添加2个新的element元素进去我想等到这两个element创建结束再继续进行后续操作,可是,每次都是执行时element还没生成。
那就判断新添加的哪两个元素ID如果有了,就证明添加成功了用if(document.getElementById(这里填你新添加元素的ID)){
//执行代码
}
//创建完成后执行
},0)
//创建完成后执行
},时间) 时间单位为毫秒
顺便推荐下自己的网站,希望楼主不要介意,请大家有空多来看看,给小弟一些意见
蜗蜗网 http://www.wowo258.com
window.onload()=function{
load();
}
function load(){
createElem();
createElem();
/*其他的代码写在这里*/
}
function createElem(){
..../*创建element*/
}