Solved

java script image map problem

Posted on 2000-04-28
2
164 Views
Last Modified: 2010-04-09
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
Comment
Question by:bjbmod
2 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 75 total points
Comment Utility
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
 

Author Comment

by:bjbmod
Comment Utility
I am happy, Thank you!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now