PDA

View Full Version : Good ol' Internet Explorer and Java Script


mr_grumpy_man
26-06-2000, 23:45
Come on then all you smarty pants...

I've got a hideously over-complicated menu page, and I've been using Javascript to do image swapping onmouseover/out and handling loading new pages onclick. However, I can't get new pages to load in Internet Explorer. I suspect it's to do with how I try call new pages.

I've tried self/parent/document.location, all with no effect. Netscape, on the other hand, doesn't seem that fussed which I use.

Anyone out there with any ideas?

Cheers all.

------------------
"Nothing defines humans better than their willingness to do irrational things in the pursuit of phenomenally unlikely payoffs."

Jinx M
27-06-2000, 09:10
Addy?

mr_grumpy_man
27-06-2000, 09:18
Hmmmm... I'm still working on it... go on then :

www.mr-grumpy.freeserve.co.uk/main_menu.html (http://www.mr-grumpy.freeserve.co.uk/main_menu.html)

Cheers

Jinx M
27-06-2000, 10:24
This'll be the problem:

<a href="#"
onmouseover="if (document.images){switchImage(0,'b')}"
onmouseout="if (document.images){switchImage(0,'a')}"
onclick="jumpto(0);">

The href is set to #. The onclick thingy is an odd beasty. It work in image tags in IE but not in Nutscrape and it works in HREF tags in Nutscrape but not in IE. Great huh? Oh the joys of building web sites... Anyway, IE take the value in scr="#" over the onclick (which I think is actaully the right way...)

But how to fix it? Well, this should work:

<a href="javascript:jumpto(0)"
onmouseover="if (document.images){switchImage(0,'b')}"
onmouseout="if (document.images){switchImage(0,'a')}"
onclick="jumpto(0);">

The href="javascript:jumpto(0)" is a great technique for doing clever things with links but it fails to work on Nutscrape. Luckily however, the onclick should cover it.

Let me know if it works http://forums.gameplay.com/ubb/teeth.gif

Jinx M
27-06-2000, 10:28
Actually, thinking about it, I might be talking a lot of trousers. Try this first:

<a href="#"
onclick="jumpto(0);"
onmouseover="if (document.images){switchImage(0,'b')}"
onmouseout="if (document.images){switchImage(0,'a')}">

The order in which things are presented matters so its probably worth sticking it first to see if it makes any difference.

Jamp30
27-06-2000, 18:42
i think you could be :)
onclick works for me find with href="#"
as long as its something like an open window command

mr_grumpy_man
27-06-2000, 18:51
Many thanks for the advice. Unfortunatly your suggestion didn't work. I've decided to stop being so lazy and stick the actual urls in the <a> tags, rather than relying on javascript's onclick to do the business. To be honest I don't know why I did it that way in the first place, I have no plans to chop and change the layout regularly, on plain old links with image swapping will do I guess.

If you're still curious then I'll leave the original on the site, I'll call it main_original.html. I'd be curious about it, but being a student, working full time and worrying about dissertation etc I'll stick with what works.

Thanks again.

------------------
"Nothing defines humans better than their willingness to do irrational things in the pursuit of phenomenally unlikely payoffs."