...

View Full Version : JScript working in Firefox but not IE



TJframe
12-10-2009, 04:13 PM
Hello - I'm a total newbie to html and javascript but have been forced to learn it somewhat since I'm making a website for my wife's business.

Anyway, the site has a page where people can choose from menuitems of a form ("select" elements). That form info is then used to call Foxycart. I've decided to link the choosing of those menu-items to showing appropriate product images, thus providing visual feedback for the buyer.

I have hacked my way to a point that the page does what I want in Firefox, but it breaks in IE and I have no idea why since the same sort of simple code algorithm to poll the menus with "document.getElementByIdworks" works in IE until I leave the page, but then stops working when I return.

The page is here:http://angelatoyarn.squarespace.com/build-your-own-gelato (the site is still a WIP obviously)

In Firefox everything is fine - I can select the items I want and the pictures of those images appear at the bottom of the page. If I leave the page and come back, the function Updateyarn() is called which grabs the .selectedindex values and re-inserts the images. But in IE when I leave the page and come back the select-menus retain their previous values (as they should) but my update yarn () function errors out and doesn't return a valid integer.

Please Help! I have no Earthly clue why the IE version is breaking.

-thanks,

- TJ

gusblake
12-10-2009, 04:36 PM
working in Firefox but not IE

Welcome to web design.

Have you tried adding onload="Updateyarn()" to the body tag?

Edit - just noticed you call it lower down in the body.

Everything worked fine when I tested your page in IE6 - which version are you on?

Kor
12-10-2009, 04:42 PM
Your document seems to have serious XHTML errors, first at all. HTML and XHTML incorrect coding might produce JavaScript errors as well.

test your page at : http://validator.w3.org/

Kor
12-10-2009, 04:47 PM
Welcome to web design.

Have you tried adding onload="updateYarn()" to the body tag?
Not a good idea. At least not in the body tag. And not when you are using a lot of other libraries or external codes which use, for sure, the window.onload event.

javascript events may be called in the direct way (element.onevent) only once. For repeated calling of other function during the same element, on using the same event, there are different workarounds. But I don't think it is the case here.

TJframe
12-10-2009, 05:09 PM
Welcome to web design.

Have you tried adding onload="Updateyarn()" to the body tag?

Edit - just noticed you call it lower down in the body.

Everything worked fine when I tested your page in IE6 - which version are you on?


YES!!! that worked.. kick ***! This has to be the fastest support forum help/solution I have ever had - I was planning on languishing for a week or more trying to get this sorted out. Had no idea it was so rudimentary. (using IE 8 by the way)

Kor: thanks for the heads up on the HTM code in general. I will spend some time trying to clean things up before moving on.

- TJ



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum