Results 1 to 3 of 3

Thread: Javascript error in IE only

  1. #1
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Javascript error in IE only

    Hello everyone,

    I am using 2 scripts, one to call an accordion and one to call arrows for the corresponding.

    Now i am trying to open this via an external link.
    Here is the code that i am using it

    Code:
    <div style="width: 170px; padding-top: 5px; padding-bottom: 5px; cursor:pointer; color:#003399;" class="fontSmall">
    <span onFocus="LocalTurnArrow(this,'Title01');">
    <a href="#Title01" onclick="numberOne()">
    <span onclick="LocalTurnArrow(this,'Title01')">Learn more</span></a></span></div>
    It is working perfectly fine for all browsers, but in IE 8, its showing me an error, " object doesnt support this property or method " and i know the reson being the introduction of the <span onclick="LocalTurnArrow(this,'Title01')">Learn more</span>. As i had to use it to toggle the arrows.

    The script where it is showing error in IE is below..
    Code:
    function turnArrow (what) {
    	$$('div#widget h3 span').removeClass('selected');
    	what.firstChild.className = 'selected';
    }
    and its pointing on character 2 i.e firstChild.
    Any reasons as to why IE is behaving in this manner or am I wrong somewhere.

    Awaiting replies.

    Regards
    Harleyy.
    Last edited by jscheuer1; 07-20-2011 at 12:43 PM. Reason: format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    From what you show, that second span has no firstChild capable of a className. Other browsers are probably error correcting for this and ignoring it. IE apparently isn't. I'd just get rid of it.

    If you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Harleyy (07-22-2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I just made a new function for that span and it worked in IE without errors or warnings.
    Thanks a lot for your time and reply.

Bookmarks

Posting Permissions

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