当前位置: 代码迷 >> JavaScript >> 网站的“设为主页”功能怎么动态得到当前域名
  详细解决方案

网站的“设为主页”功能怎么动态得到当前域名

热度:23   发布时间:2012-03-01 10:25:47.0
网站的“设为主页”功能如何动态得到当前域名?
<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]
  相关解决方案