如显示图片:
<img src="" id="myimg"/> <script> var url = document.location.href.substring(0,document.location.href.indexOf(window.document.location.pathname)) + document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1); var imgurl=url+"myimg.png"; document.getElementById("myimg").src=imgurl; </script> |
设置背景图片:
var url = document.location.href.substring(0,document.location.href.indexOf(window.document.location.pathname)) + document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1); document.body.style.backgroundImage="url('"+url+"mybackground.png')"; |
全站熱搜
留言列表