IE8 jQuery错误行:2个字符:36689

时间:2013-09-11 01:33:46

标签: jquery internet-explorer-8 runtime-error


我有这个错误真让我抓狂。
除IE8或更低版本外,所有浏览器中的一切工作都很好 这是我的HTML代码:

<form id="rentForm" method="post" action="rentsubmit.php" enctype="multipart/form-data"> 
<select id="rentmake" name="make" class="selectFields">
<option value="0">Select</option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
</select>
<select id="rentmodel" name="model" class="selectFields">
<option value="0">Select</option>
<option value="1 Series">1 Series</option>
<option value="2 Series">2 Series</option>
</select>
<input type="text" id="rentcolor" name="color" class="fields" />
<input type="text" name="interiorcolor" id="rentinteriorcolor" class="fields" />
<input type="text" id="rentmilage" name="milage" class="fields"/>

<input type="text" id="rentdailyprice" name="dailyprice" class="fields"/>

<input type="text" id="rentweeklyprice" name="weeklyprice" class="fields"/>

<input type="text" id="rentmonthlyprice" name="monthlyprice" class="fields"/>

<input type="text" name="mobilenumber" id="rentmobilenumber" class="fields" />
<input type="text" name="phonenumber" id="rentphonenumber" class="fields" />
<input type="text" name="email" id="rentemail" class="fields" />
<input type="file" name="photo1" id="rentphoto1" />
<input type="file" name="photo2" id="rentphoto2" />
<input type="file" name="photo3" id="rentphoto3" />
<input type="file" name="photo4" id="rentphoto4" />
<input type="file" name="photo5" id="rentphoto5" />
<input type="file" name="photo6" id="rentphoto6" />
<div id="rentFinish">Finish</div>
<div id="rentPreFinishSpan"></div>
</form>

这是响应它的javaScript:

$('#rentFinish').click(function(){
if($('#rentcolor').val()!=='' && $('#rentinteriorcolor').val()!=='' && $('#rentdailyprice').val()!=='' && $('#rentweeklyprice').val()!=='' && $('#rentmonthlyprice').val()!=='' && $('#rentmilage').val()!==''){
    if($('#rentmobilenumber').val()=='' && $('#rentphonenumber').val()=='' && $('#rentemail').val()==''){
        $(this).next('div').fadeOut().html("Please enter 1 contact info at least").fadeIn();
    }
    else{
if($('#rentphoto1').val()=='' && $('#rentphoto2').val()=='' && $('#rentphoto3').val()=='' && $('#rentphoto4').val()=='' && $('#rentphoto5').val()=='' && $('#rentphoto6').val()=='' )
{
    $(this).next('div').fadeOut().html("please upload 1 photo at least").fadeIn();
}
else{
if($('#rentmake').val()=='0' || $('#rentmodel').val()=='0'){
        $(this).next('div').fadeOut().html("Please select car make and model").fadeIn();
    }
    else{

$('#rentForm').submit();
    }}
}}
else{
    $(this).next('div').fadeOut().html("All fields are required").fadeIn();
    }
});

当点击'#rentFinish'按钮时,js将检查前6个表单字段是否为空,然后检查至少一个联系信息字段,然后检查至少一张照片,如果一切正常则表格将按照您在js。中看到的提交。

除IE8外,所有浏览器都能完美运行 在IE8中,当编译器到达处理该表单提交的部分时发生错误,本部分:

$('#rentForm').submit();

错误是:访问被拒绝,jQuery-1.8.2.min.js错误行:2 char:36689
我尝试并研究了这个,但我什么都没有,请任何人帮忙 在此先感谢。

1 个答案:

答案 0 :(得分:1)

您是否编辑了此问题的布局代码?..如果是这样,您的html中存在多个错误。如果没有,请验证并解决您的问题。以下内容已从原始标记更改。

表单enctype中的额外空格。

在多个选择标记中声明的

type =“text”。

删除了没有开始标记的多个结束选择标记。

删除了单个表格单元格标记。

<form id="rentForm" method="post" action="rentsubmit.php" enctype="multipart/formdata"> 
<select id="rentmake" name="make" class="selectFields">
<option value="0">Select</option>
<option value="Audi">Audi</option>
<option value="BMW">BMW</option>
</select>
<select id="rentmodel" name="model" class="selectFields">
<option value="0">Select</option>
<option value="1 Series">1 Series</option>
<option value="2 Series">2 Series</option>
</select>
<input type="text" id="rentcolor" name="color" class="fields" />
<input type="text" name="interiorcolor" id="rentinteriorcolor" class="fields" />
<input type="text" id="rentmilage" name="milage" class="fields"/>
<input type="text" id="rentdailyprice" name="dailyprice" class="fields"/>
<input type="text" id="rentweeklyprice" name="weeklyprice" class="fields"/>
<input type="text" id="rentmonthlyprice" name="monthlyprice" class="fields"/>
<input type="text" name="mobilenumber" id="rentmobilenumber" class="fields" />
<input type="text" name="phonenumber" id="rentphonenumber" class="fields" />
<input type="text" name="email" id="rentemail" class="fields" />
<input type="file" name="photo1" id="rentphoto1" />
<input type="file" name="photo2" id="rentphoto2" />
<input type="file" name="photo3" id="rentphoto3" />
<input type="file" name="photo4" id="rentphoto4" />
<input type="file" name="photo5" id="rentphoto5" />
<input type="file" name="photo6" id="rentphoto6" />
<div id="rentFinish">Finish</div>
<div id="rentPreFinishSpan"></div>
</form>