网站的“设为主页”功能如何动态得到当前域名?
<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]
查询谷 - www.chaxungu.com
网站的“设为主页”功能怎么动态得到当前域名
编辑:chaxungu时间:2022-10-02 23:20:55分类:web开发