Internet Explorer 对象预期错误 LINE: 64
该代码适用于 Firefox 和 Chrome。
我不断收到 Internet Explorer 对象预期错误。我删除了受影响的代码,它继续运行,直到第 64 行之后的任何代码都消失了。
问题从第 64 行开始,代码如下:
受影响的代码:
$(document).ready(function () {
preload(preloadi);
});
所有 JQUERY 代码:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
/* -------------------------------- Preload images function for speed*/
function preload(arrayOfImages) {
$('body').addClass("loading");
$(arrayOfImages).each(function () {
$('<img/>')[0].src = this;
});
$('body').removeClass("loading");
}
/* -------------------------------- Generic functionality function */
function transformImage(classCSS, original, link, backArray, count, prevClass) {
var back = '<div id="back"><div id="_' + backArray[backArray.length-1] + '"></div></div><div class="_0"></div><div class="_1"></div><div class="_4"></div><a id="contact" href="mailto:pbn@casa.gov.au"></a><a id="rightlink" target="_blank" href="http://www.casa.gov.au/scripts/nc.dll?WCMS:STANDARD::pc=PC_101078"></a>';
link[prevClass] = window.original;
window.original = link[classCSS];
if (classCSS != '0') { link[classCSS] += back; }
$('.inter').fadeTo(250, 0.25, function () {
$('.inter').html(link[classCSS]);
$('.inter').css({
'background-image': 'url("' + classCSS + '.png")'
});
$('.inter').fadeTo(250, 1.00);
});
}
/* -------------------------------- Variables */
var preloadi = [
'1.png',
'2.png'
];
var backArray = [];
var prevClass = '0';
var classCSS = '0';
var count = 0;
original = '<div class="_2"></div><div class="_3"></div>';
var link = [
'<div class="_2"></div><div class="_3"></div>',
'a',
'b',
'c',
'd'
];
/* -------------------------------- Event handlers */
$(document).ready(function () {
preload(preloadi);
});
$(document).on('mouseenter mouseleave', '.inter [class]', function (event) {
$('.' + this.classCSS + 't').toggle(event.type === 'mouseenter');
});
$(document).on('change', '#selectContainer [id]', function () {
backArray[count] = classCSS;
count += 1;
prevClass = classCSS;
classCSS = $("select").val();
transformImage(classCSS, original, link, backArray, count, prevClass);
})
$(document).on('click', '.inter [class], .inter #back [id]', function () {
if (this.id) {
count -= 1;
backArray.pop(count);
} else {
backArray.push(classCSS);
count += 1;
}
prevClass = classCSS;
classCSS = (this.id || this.className).substr(1);
transformImage(classCSS, original, link, backArray, count, prevClass);
})
</script>