如显示图片:

 
 
<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')";
 
arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()