【发布时间】:2013-09-20 22:32:35
【问题描述】:
我只在 IE8 中遇到了一个奇怪的错误,在 IE9 中没有。错误信息是:
SCRIPT1028:预期的标识符、字符串或数字
这是我的标记:
<style>
.warrior { color: red; }
.ninja { color: blue; }
.wizard { color: green; }
</style>
<div id="player"></div>
<script src="Scripts/jquery.min.js"></script>
<script>
(function () {
"use strict";
var joeBlow = {
name: "Joe Blow",
class: "ninja",
age: 35
};
$("#player").html(joeBlow.name + " " + joeBlow.age).addClass(joeBlow.class);
}());
</script>
我的期望是DIV 将“Joe Blow 35”写成蓝色,但我收到了上面的错误。
是什么导致 IE8 中发生这种情况,但 IE9 或 IE10 中没有?
【问题讨论】:
-
class是保留字,可能是这样。
标签: javascript jquery html css internet-explorer-8