|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Jun 2004
Lives in Tennessee, USA
Hosted on Pass56
38 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
|
For as long as there's been Javascript, we haven't gotten along; I have no explanation for this... Anyway, I'm trying to write a tiny, tiny piece of simple code that, as far as I can tell, should work but doesn't, and I can't understand why not.
Here's the whole thing: Code:
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function showPic(source) {
alert(source);
var viewer = getElementByID("viewer");
viewer.setAttribute("src",source);
}
</script>
</head>
<body>
<img src="exerIII-resources/village-map.jpg" width="600" height="402" usemap="#village-map" border="0">
<map name="village-map">
<area shape="circle" coords="364,179,24" href="#" title="Look at this!" onmouseover="showPic('exerIII-resources/green-dome.jpg');">
</map>
<img id="viewer" src="exerIII-resources/empty.jpg" width="300" height="300" />
</body>
</html>
I'm simply trying to display an image in a box when parts of a map are run over -- should be pretty simple, right? Can somebody point out what I'm doing wrong?? Thanks, J. |
|
|
|
|
|
#2 (permalink) |
|
Surpass Fan
Excelling Contributor
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
937 posts
Gave thanks: 2
Thanked 95 times
|
var viewer = document.getElementById("viewer");
case sensitive; ID should be Id document; tell the browser where to find the element Code; include your <!DOCTYPE so browsers don't have to guess
__________________
Where would you be if you were at the highest court in the land (US)? |
|
|
|
|
|
#4 (permalink) |
|
Surpass Fan
Excelling Contributor
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
937 posts
Gave thanks: 2
Thanked 95 times
|
DOCTYPE is always the first thing, especialy before script scratching.
__________________
Where would you be if you were at the highest court in the land (US)? |
|
|
|