Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    JScript working in Firefox but not IE

    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/...our-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
    Last edited by TJframe; 12-10-2009 at 04:34 PM.

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    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?
    Last edited by gusblake; 12-10-2009 at 04:47 PM.

  • Users who have thanked gusblake for this post:

    TJframe (12-10-2009)

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by gusblake View Post
    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.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gusblake View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •