另一个IE'期望对象'没有信息的错误 [英] Yet another IE 'Object expected' error with no information
问题描述
嘿,我一直在此网站上遇到此错误. >
我仅在IE6和IE7的第1行上遇到了可怕的Object expected
错误.我只是想知道是否有人知道这可能与什么有关.我知道整个结尾的逗号问题,因此我对此非常小心.
任何想法都将不胜感激.谢谢.
我们修复了IE中的预期对象"错误,因此请在您的评论中回答问题:
问题出在您的HTML中.
您拥有此HTML,每个标签一次:
<div class='tab' id='introduction'>
<h2 id='introduction'>Introduction</h2>
</div>
<div class='body' id='introduction' style='display:block'>
问题是您要用id='introduction'
指定两个元素.
出于各种原因,您不应这样做:
- 这导致this site.
I am getting the dreaded
Object expected
error on line 1, character 21 in IE6 and IE7 only. I just wondered if anyone had any idea what this could be related to. I know about the whole trailing commas problem so I am very careful with that.Any ideas will be much appreciated. Thanks.
解决方案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)
这篇关于另一个IE&#39;期望对象&#39;没有信息的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- It's causing validation errors.