window.location = document.getElementsByTagName("a")[4].href;
document.ready(function(){
alert("sss");
});
我想实现的是这样一个小功能,就是页面跳转到上面代码提到的href后,页面完全加载完了再做一些js的操作。但是目前不论是document.ready还是window.onload都没有什么效果。
请教各位。

解决方案 »

  1.   

    既然 已经调用了window.location,那么你的document已经变掉,所以还在原来的html页面中写
    document.ready(function(){     alert("sss"); }); 这段代码是不会执行的。
    你将这段代码移动到,你要跳转的那个html文件中,就可以解决了。
      

  2.   

    location以后页面已经变了,你不可能让新页面执行原页面中的js。