This article describes the JS implementation of the click picture to change the page background image method. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<title> Click on the picture to change the background picture of the page </title>
<body bgcolor= "#FFFFFF" leftmargin= "0" marginwidth= "0" >
<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.ondblclick=restore
-->
</script>
</p>
<p align= "center" ><span class= "bgimages" onclick= "tile (); Event.cancelbubble=true" >
<br>
</span></p>
</td>
</tr>
</table>
</center>
</body>
I hope this article will help you with your JavaScript programming.