Yet another IE 'Object expected' error with no information

后端 未结 1 896
野的像风
野的像风 2021-01-17 01:29

Hey, I have been pulling my hair out with this error I am having on this site.

I am getting the dreaded Object expected error on line 1, character 21 in

相关标签:
1条回答
  • 2021-01-17 02:20

    We fixed the "Object expected" error in IE, so to answer the question in your comments:

    The problem is in your HTML.

    You have this HTML, once for each tab:

    <div class='tab' id='introduction'>
        <h2 id='introduction'>Introduction</h2>
    </div>
    
    <div class='body' id='introduction' style='display:block'>
    

    The problem is that you're specifying two elements with id='introduction'.

    For various reasons, you should not do that:

    • It's causing validation errors.

      Line 37, Column 27: Duplicate ID introduction.
      Line 36, Column 39: The first occurrence of ID introduction was here.

    • It's breaking your tabs in IE7.
    • There are also other reasons, but they aren't important here.

    If I change it to (for example):

    <div class='tab' id='introduction'>
        <h2 id='introduction'>Introduction</h2>
    </div>
    <div class='introduction body' style='display:block'>
    

    (remember to change all four instances in the same way)

    And if I change your JS to this (for example), it works:

    // Show selected
    Spark('.' + currentTab)
    
    0 讨论(0)
提交回复
热议问题