日期:2014-05-16 浏览次数:20389 次
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图片反转</title>
</head>
<body>
<a href="next1.htm" ><img src="images/mouse_one_off.jpg" id="one"/></a> <br/>
<a href="next2.htm" ><img src="images/mouse_two_off.jpg" id="two"/></a>
<script type="text/javascript">
window.onload = rolloverInit();
function rolloverInit() {
for(var i=0 ; i < document.images.length; i++) {
if(document.images[i].parentNode.tagName == "A") {
setUpRollover(document.images[i]);
}
}
}
function setUpRollover(thisImage) {
thisImage.outImage = new Image();
thisImage.outImage.src = thisImage.src;
thisImage.onmouseout = function() {
this.src = this.outImage.src;
}
thisImage.overImage = new Image();
thisImage.overImage.src = "images/mouse_" + thisImage.id + "_on.jpg";
thisImage.onmouseover = function() {
this.src = this.overImage.src;
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图片反转</title>
<script type="text/javascript">
window.onload = rolloverInit();
function rolloverInit() {
for(var i=0 ; i < document.images.length; i++) {
if(document.images[i].parentNode.tagName == "A") {
setUpRollover(document.images[i]);
}
}
}
function setUpRollover(thisImage) {
thisImage.outImage = new Image();
thisImage.outImage.src = thisImage.src;
thisImage.onmouseout = function() {
this.src = this.outImage.src;
}
thisImage.overImage = new Image();
thisImage.overImage.src = "images/mouse_" + thisImage.id + "_on.jpg";
thisImage.onmouseover = function() {
this.src = this.overImage.src;
}
}
</script>
</head>
<body>
<a href="next1.htm" ><img src="images/mouse_one_off.jpg" id="one"/></a> <br/>
<a href="next2.htm" ><img src="images/mouse_two_off.jpg" id="two"/></a>
</body>
</html>