[thelist] image swap works in Firefox and IE, not Chrome or Safari
Joel D Canfield
joel at bizba6.com
Tue Feb 15 14:53:39 CST 2011
Testing on Win7 right now. This works in Firefox and IE, does nothing at all
in Chrome and Safari. The code validates in HTML Tidy but I'm always
suspicious of my javascript.
What's broken here?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Image Swap Javascript Example</title>
<script type="text/javascript">
image1 = new Image()
image1.src = "papago_park_oasis.jpg"
image2 = new Image()
image2.src = "joel.jpg"
image3 = new Image()
image3.src = "tree_in_rock_2.jpg"
</script>
</head>
<body>
<div style="width:128px;float:right;border:1px solid
#122559;padding:1em;margin:1em;">
<a href="#" onclick="imageSwap.src='papago_park_oasis.jpg';">Oasis</a><br />
<a href="#" onclick="imageSwap.src='joel.jpg';">Joel</a><br />
<a href="#" onclick="imageSwap.src='tree_in_rock_2.jpg';">Tree</a>
</div>
<div style="float:left;width:512px;border:1px solid
#122559;padding:1em;margin:1em;">
<img src="joel.jpg" id="imageSwap" />
</div>
</body>
</html>
More information about the thelist
mailing list