• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

java script image map problem

when you enter my and the mouse is over the image map that is linked to show text in a form you get an error but when you enter the page and the mouse is not over the image map it loads just fine. how do i fix it, you can view the page at http://209.161.209.101/market/right.htm
0
bjbmod
Asked:
bjbmod
1 Solution
 
jbirkCommented:
The problem is that the form element you are modifying doesn't exist yet when you rollover it while it's still loading.  This causes an error since it can't find the object.  So you have to set a variable in the onLoad handler for the document.  This will ensure that it is loaded before trying to modify it.

onLoad="loaded=true"

Then in the map areas:
onMouseOver="if (loaded) theForm.out.value='SHOPPING'"

Also be sure to define loaded in the header:
<SCRIPT language="JavaScript">
<!--
var loaded = false;
// -->
</SCRIPT>
</HEAD>

This should fix it for you.
-Josh
0
 
bjbmodAuthor Commented:
I am happy, Thank you!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now