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

网站的“设为主页”功能如何动态得到当前域名?
<a   href= "# "   onClick= "this.style.behavior= 'url(#default#homepage) ';this.setHomePage( 'localhost '); "> 设为主页 </a>

请问该如何改上面的代码?谢谢

------解决方案--------------------
你写的是静态网站?动态网站的话很容易实现啊
------解决方案--------------------
<a href= "# " onClick= "this.style.behavior= 'url(#default#homepage) ';this.setHomePage(location.host); "> 设为主页 </a>
------解决方案--------------------
document.URL.split( "/ ")[2]