25、任由你自己选择背景图

25、任由你自己选择背景图

要完成此效果把如下代码加入到<body>区域中

 

<script language="JavaScript1.2">

<!--

function tile(){

if (!document.all)

return

var source=event.srcElement

if (source.tagName=="IMG")

document.body.style.backgroundImage="url("+source.src+")"

}

 

function restore(){

document.body.style.backgroundImage=''

}

document.body.onclick=restore

-->

</script>

      </p>

      <p align="center"><span class="bgimages" onClick="tile();event.cancelBubble=true">

      <img src="images/a.jpg" height=96 width=96 border=2>

      <img src="images/01.gif" height=96 width=96 border=2><br>

      <img src="images/03.gif" height=96 width=96 border=2>

      <img src="images/02.gif" height=96 width=96 border=2></span></p>

 

 

Write a comment

Comments: 1
  • #1

    csr04 (Tuesday, 01 September 2009 14:04)

    test