我正在尝试使用jQuery UI为表单上的转换设置动画,而在Firefox和Chrome中代码正常工作时,IE8中会出现Javascript错误。
我正在使用jquery-ui-1.8.2.custom.min.js并且给出的错误是:
Message: 'end.0' is null or not an object - Line: 819 - Char: 6
我的CSS:
.formfield {
background-color: White;
border: none;
padding: 5px;
width: 90%;
overflow: hidden;
margin: 0px;
}
.formfieldselected {
background-color: MintCream;
border: none;
padding: 5px;
margin: 0px;
overflow: hidden;
}
使用Javascript:
$(document).ready(function()
{
$(":input").each(function()
{
var myInput = $(this);
if (this.type == 'submit')
{
return;
}
myInput.bind('focusin', function()
{
$('#' + this.id + 'field').removeAttr('style'); // Reset Style if broken
$('#' + this.id + 'field').switchClass('formfield', 'formfieldselected', 300);
$('#' + this.id + 'helpbox').removeClass('helpboxhidden').addClass('helpboxvisible');
});
myInput.bind('focusout', function()
{
$('#' + this.id + 'field').switchClass('formfieldselected', 'formfield', 300);
$('#' + this.id + 'helpbox').removeClass('helpboxvisible').addClass('helpboxhidden');
});
});
...
}
最后,这段代码应该是其中一个元素:
<DIV id="eventnamefield" class="formfield">
<DIV id="eventnamehelpbox" class="helpboxhidden">
This name is used throughout the system to refer to this event and is shown to Attendees
</DIV>
<label for="eventname" class="adminformlabel">Event Name:</label>
<br />
<input type="text" name="eventname" value="" id="eventname" maxlength="50" class="adminforminput" />
</DIV>
答案 0 :(得分:3)
找到答案。
原来IE下的jQuery UI无法处理名称引用的颜色。将颜色更改为CSS中的十六进制代码可以解决问题。