日期:2014-05-16  浏览次数:20359 次

设为首页的代码?
在a标签内,我用onclick="this.style.behavior='url(#default#homepage)';this.setHomePage(top.location.href);return(false);"设置了IE浏览器设为首页的链接。
怎样加入浏览器的判断?当遇到非IE时,提示用户手动设置?我这样写的代码通不过:
onclick="if(document.all){this.style.behavior='url(#default#homepage)';this.setHomePage(top.location.href);return(false);}else{alert("对不起,您的浏览器不支持自动收藏首页,请手动收藏。");return false;}"

------解决方案--------------------
感觉你设置的代码就不对,

this的指针在你的代码里应该是指向a标签吧

把this换成document.body试试