Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select onchange event trigger, IE Browsers only?

Status
Not open for further replies.

Mach321

Programmer
May 4, 2005
5
US
I am having a curious problem with a javascript function and the best way I know how to describe this problem is with an example. This script has only been designed for the use of IE browsers only, so other browsers will not work at all, sorry.

Problem javascript code:

Code:
function changeRegion(regionNumber) {
  document.Search.Region.selectedIndex = parseInt(regionNumber);
  document.Search.Region.onchange();
}

If I remove the last line, the onchange() event, the code works fine everytime, so I am guessing this is the problem area? This is indeed a unique problem, because it does not cause a problem on all calls to this function, only when certain areas are calling it?

What in the world am I talking about, lol, well I did say an example was the best way to explain this one:

If you goto my link at the end of my query here, you should find that an image map page should load. Once loaded if you move your mouse over the USA and click, another image map, of the USA, should load, now don't get ahead of me here, please.

Now, if you select the Unknown selection from the Country selection box, you should return the original entry point. If you now select the Country of USA, instead of moving your mouse over that area, again the image map of the USA should load.

So far this has proved that both the mouseover of the country and the selection of the country from the selection box do the same thing, right?

Ok, from this point on is where the problem happens at, if you select the state of Alabama from either the selection box or by moving your mouse over it, the appropriate image should load.

If you select the state of Washington from the selection box, that state loads great,

[CAUTION HERE: Your IE browser will shut down on the next step!]

however if you move your mouse over this state and click we get a big ole error message and IE shuts down??????? You can see that when you move your mouse over this location that the above function is called in your browser's status bar. This one is driving me nuts, 1: because the map loads fine when selected from the selection box. The above function does nothing more than change the value of this selection box to the state of Washington and then trigger the onChange event, so the same functions are being called. Why it works one way and not the other?

Like I said, the last option I mentioned above will shut down your browser, so be prepared.

If can handle restarting your browser more than once, you will find that other states load like the state of Alabama and other states also load like the state of Washington, I only use these two as examples to get my problem across.

Hopefully someone can help me understand why this is happening?

Thanks for your time,
Mark

PS: The link:
 

however if you move your mouse over this state and click we get a big ole error message and IE shuts down???????

Not for me - then again, do you mean the state on the USA map, or the state once you've chosen Washington from the drop-down?

Have you tried debugging this in firefox and looking in the JS console for errors?

I cannot believe that you need to have that alert pop up each time just to load things correctly.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Code:
Not for me - then again, do you mean the state on the USA map, or the state once you've chosen Washington from the drop-down?

BillyRay, the drop-down selection works for me as well, however it is the image map clicking that seems to dislike Washington?

Code:
Have you tried debugging this in firefox and looking in the JS console for errors?

My coding was written for IE browsers only, so I think firefox will probably show hundreds of errors, it will be quite some time before I will be moving this code to work with other browsers.

Code:
I cannot believe that you need to have that alert pop up each time just to load things correctly.

Well I would agree on most cases, however this script will attempt to load an external script whenever a new map is chosen and javascript will pass over this attempt very quickly into the next line of code. If this next line of code uses any variables from the external file, you must pause javascript for a moment or two for the external file to load. I have tried it without the pop-up and prefer to have it that way, but the script must pause to load the external file then proceed. This pause can be done by other methods but I chose the pop-up for this pause.

Thanks for your quick reply, but I am still having the problem with the state of Washington?
 

Where is the image map defined for the US map? How do I click on Washington? All I can seem to get is DC...

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Code:
Where is the image map defined for the US map? How do I click on Washington? All I can seem to get is DC...

Move your mouse to the left edge of the number inside of the state, when the tooltip shows "Washington", click.

The States of Washington, Oregon, Nevada, etc. all shut down my IE browser, however choosing these states from the selection box does not? The states of Alabama, Mississippi, Georgia, etc do not? This is my problem, the same functions are be called, however from the image map it shuts down the browser?


Mark
 

Still works fine for me. Have you tried it on any other PCs? It might just be something quirky with your installation.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top