当前位置:编程学习 > 网页素材 >>

自己选择背景图片

[html]----------------------------------------------------------------------------------------
脚本说明:
把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
if (navigator.appName == "Microsoft Internet Explorer") {
image_directory = "http://www.cn76.com/javascript/";
clear = new Image();  clear.src = image_directory + "clear.jpg";
pic1 = new Image();  pic1.src = image_directory + "chameleon.jpg";
pic2 = new Image();  pic2.src = image_directory + "gecko.jpg";
pic3 = new Image();  pic3.src = image_directory + "lizard.jpg";
pic4 = new Image();  pic4.src = image_directory + "toad.jpg";
}
function imagechange(imgName) {
if (navigator.appName == "Microsoft Internet Explorer") {
document.body.background = eval(imgName + ".src");
   }
}
//  End -->
</script>
<a href="default.htm" onMouseOver="imagechange('pic1');" onMouseOut="imagechange('clear');"><img src=http://www.sucai.com/texiaofile/"5.jpg"></a>
<a href="default.htm" onMouseOver="imagechange('pic2');" onMouseOut="imagechange('clear');"><img src=http://www.sucai.com/texiaofile/"0015.gif"></a>
<a href="default.htm" onMouseOver="imagechange('pic3');" onMouseOut="imagechange('clear');"><img src=http://www.sucai.com/texiaofile/"00012.gif"></a>
<a href="default.htm" onMouseOver="imagechange('pic4');" onMouseOut="imagechange('clear');"><img src=http://www.sucai.com/texiaofile/"tb3.jpg"></a>
[/html]
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,