muttley1
asked on
Image Map
Hi There,
This is probably very simple but only when you know how!
The following code works perfectly with IE, but doesn't work with Netscape.
Why??
<SCRIPT Language="JavaScript">
<!--
start = new Image()
start.src = "images/starters.gif"
main = new Image()
main.src= "images/maincourse.gif"
dessert = new Image()
dessert.src = "images/dessert.gif"
function menuStart() {
document.menu.src = start.src;
}
function menuMain() {
document.menu.src = main.src;
}
function menuDessert() {
document.menu.src = dessert.src;
}
-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#b99d80">
<map name="menumap">
<area shape="rect" coords="11,16,165,50" href="JavaScript: menuStart()">
<area shape="rect" coords="166,15,365,53" href="JavaScript: menuMain()">
<area shape="rect" coords="366,18,514,49" href="JavaScript: menuDessert()">
</map>
<P><CENTER><IMG SRC="images/starters.gif" NAME="menu" WIDTH="530" HEIGHT="1000"
ALIGN="BOTTOM" BORDER="0" NATURALSIZEFLAG="3" USEMAP="#menumap"></CENTER >
</BODY>
</HTML>
This is probably very simple but only when you know how!
The following code works perfectly with IE, but doesn't work with Netscape.
Why??
<SCRIPT Language="JavaScript">
<!--
start = new Image()
start.src = "images/starters.gif"
main = new Image()
main.src= "images/maincourse.gif"
dessert = new Image()
dessert.src = "images/dessert.gif"
function menuStart() {
document.menu.src = start.src;
}
function menuMain() {
document.menu.src = main.src;
}
function menuDessert() {
document.menu.src = dessert.src;
}
-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#b99d80">
<map name="menumap">
<area shape="rect" coords="11,16,165,50" href="JavaScript: menuStart()">
<area shape="rect" coords="166,15,365,53" href="JavaScript: menuMain()">
<area shape="rect" coords="366,18,514,49" href="JavaScript: menuDessert()">
</map>
<P><CENTER><IMG SRC="images/starters.gif" NAME="menu" WIDTH="530" HEIGHT="1000"
ALIGN="BOTTOM" BORDER="0" NATURALSIZEFLAG="3" USEMAP="#menumap"></CENTER
</BODY>
</HTML>
ASKER
Thanks for the rapid response!
I tried using the method you suggested.
Again it worked fine with IE but it didn't with Netscape.
On thing I did notice though is the cursor changes on mousing over the hotspots. It just doesn't run the function.
It can't be that far away!
I tried using the method you suggested.
Again it worked fine with IE but it didn't with Netscape.
On thing I did notice though is the cursor changes on mousing over the hotspots. It just doesn't run the function.
It can't be that far away!
Hmm, how about this:
<area shape="rect" coords="11,16,165,50" onClick="menuStart()">
<area shape="rect" coords="166,15,365,53" onClick="menuMain()">
<area shape="rect" coords="366,18,514,49" onClick="menuDessert()">
<area shape="rect" coords="11,16,165,50" onClick="menuStart()">
<area shape="rect" coords="166,15,365,53" onClick="menuMain()">
<area shape="rect" coords="366,18,514,49" onClick="menuDessert()">
ASKER
Adjusted points to 150
ASKER
Nope!
Again works great with IE but not Netscape.
Also, the cursor doesn't change moving over the hotspots like last time.
I'm pushing it up to 150 points!
Help!!
Again works great with IE but not Netscape.
Also, the cursor doesn't change moving over the hotspots like last time.
I'm pushing it up to 150 points!
Help!!
Ah, that's because I left out the href. I admit, I'm guessing here because I can't test this:
<area shape="rect" coords="11,16,165,50" href="#" onClick="menuStart();retur n(false);" >
<area shape="rect" coords="166,15,365,53" href="#" onClick="menuMain();return (false);">
<area shape="rect" coords="366,18,514,49" href="#" onClick="menuDessert();ret urn(false) ;">
<area shape="rect" coords="11,16,165,50" href="#" onClick="menuStart();retur
<area shape="rect" coords="166,15,365,53" href="#" onClick="menuMain();return
<area shape="rect" coords="366,18,514,49" href="#" onClick="menuDessert();ret
... or better than "#" is "javascript:;"
ASKER
Thanks again but.....
It works fine with IE, not with Netscape.
(I'm beginning to sound like a stuck record!)
Now the cursor changes while mousing over the hotpoints but onClick doesn't run the functions.
I just get a little egg timer for a few seconds. No JavaScript errors either!
Any other ideas?
It works fine with IE, not with Netscape.
(I'm beginning to sound like a stuck record!)
Now the cursor changes while mousing over the hotpoints but onClick doesn't run the functions.
I just get a little egg timer for a few seconds. No JavaScript errors either!
Any other ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank's us111,
Problem solved!
I won't forget that one in a hurry.
Problem solved!
I won't forget that one in a hurry.
thx for you 150 points
ASKER
you're welcome :-)
I wouldn't have seen that in a million years :)
But I am wondering if NS works with the functions as posted above:
function menuDessert() {
document.menu.src = dessert.src;
}
.... or did you have to do this?:
function menuDessert() {
document.images['menu'].sr c = dessert.src;
}
But I am wondering if NS works with the functions as posted above:
function menuDessert() {
document.menu.src = dessert.src;
}
.... or did you have to do this?:
function menuDessert() {
document.images['menu'].sr
}
ASKER
It works with both.
I use the function:
function menuDessert() {
document.menu.src = dessert.src;
}
often with mouse overs to change images.
I can't believe that // could make such a difference!
Thanks for trying anyway. I'm sure this isn't the last you've heard of me here. It's a great site.
I use the function:
function menuDessert() {
document.menu.src = dessert.src;
}
often with mouse overs to change images.
I can't believe that // could make such a difference!
Thanks for trying anyway. I'm sure this isn't the last you've heard of me here. It's a great site.
function menuStart() {
document.images['menu'].sr
}
function menuMain() {
document.images['menu'].sr
}
function menuDessert() {
document.images['menu'].sr
}