widgets导致IE中DOM元素的javascript验证与jqueryUI冲突
我就是这样包含文件的:widgets导致IE中DOM元素的javascript验证与jqueryUI冲突,javascript,jquery,jquery-ui,dom,tablesorter,Javascript,Jquery,Jquery Ui,Dom,Tablesorter,我就是这样包含文件的: <!--[if lt IE 8]> <script src="#request.base#/etc/jquery-1.7.2.min.js" language="JavaScript" type="text/javascript"></script> <![endif]--> <!--[if gte IE 8]><!--> <script src="#request.base#/etc/jque
<!--[if lt IE 8]>
<script src="#request.base#/etc/jquery-1.7.2.min.js" language="JavaScript" type="text/javascript"></script>
<![endif]-->
<!--[if gte IE 8]><!-->
<script src="#request.base#/etc/jquery-1.8.3.min.js" language="JavaScript" type="text/javascript"></script>
<!--<![endif]-->
<!-- Tablesorter: required -->
<link rel="stylesheet" href="#request.base#/css/theme.blue.css">
<script src="#request.base#/etc/jquery.tablesorter.js"></script>
<script src="#request.base#/etc/jquery.tablesorter.widgets.js"></script>
<link type="text/css" href="#request.base#/css/blitzer/1.9.2/jquery-ui-1.9.2.custom.css" rel="Stylesheet" />
<script language="javascript" src="#request.base#/etc/jquery-ui-1.9.2.full.min.js"></script>
<script language="javascript" src="codes_scripts.js"></script>
从驻留在“tablesorter”表中的表单调用ValidateAd函数(codes_scripts.js)时,使用此调用==>onsubmit=“return validateAd(this);IE中不会发生任何事情,但在Chrome和Firefox中却可以正常工作。如果我将包含此表单的行移到tablesorter表之外,它就开始工作了。想法
function validateAdd(formobj){
with (formobj)
{
var alertMsg = ""; l_Msg = alertMsg.length;
var strVal = document.getElementById("InsertFormUploadKey").value;
//1) Enter name of mandatory fields
var fieldRequired = Array("TheCode", "codename", "country", "IssuingAuthority", "IssuingAuthorityCode", "ReferenceURL");
//2) Enter field description to appear in the dialog box
var fieldDescription = Array("Code", "Code Name", "Country", "Issuing Authority", "IA Code", "Reference URL");
//3) Enter dialog message
var alertMsg = "Please provide/correct the following information:\r \n";
var l_Msg = alertMsg.length;
for (var i = 0; i < fieldRequired.length; i++)
{
var obj = formobj.elements[fieldRequired[i]];
if (obj){
//alert("field: " + fieldDescription[i] );
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "" || obj.options[obj.selectedIndex].text == "Select:" ||obj.options[obj.selectedIndex].text == "Select" || obj.options[obj.selectedIndex].text == "---"){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "radio":
//if (!(obj.checked == true))
if (obj.checked != true)
{
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "checkbox":
if (obj.selectedIndex != -1) //(obj[0].checked!=1) && (obj[0].checked!=1) ){
//it doesn't recgognize radios unless suffix is specified eg obj[i].type determines if its a radio -(!(obj.value))
{
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null || obj.value == "Unassigned"){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
}//end switch
}//end if
}//end for
//Decide the fate of form submission here
if (alertMsg.length !== l_Msg)
{
alert(alertMsg);
return false;
}
else{
document.getElementById("InsertFormUploadKey").value = "1";
return true;
}
//formobj.submit(); //document.designate.submit();
}//end with(formobj)
}
函数validatead(formobj){
带(formobj)
{
var alertMsg=“”;l_Msg=alertMsg.length;
var strVal=document.getElementById(“InsertFormUploadKey”).value;
//1) 输入必填字段的名称
var fieldRequired=数组(“代码”、“代码名”、“国家”、“颁发机构”、“颁发机构代码”、“引用URL”);
//2) 输入要显示在对话框中的字段说明
var fieldDescription=数组(“代码”、“代码名”、“国家”、“发证机构”、“IA代码”、“参考URL”);
//3) 输入对话框消息
var alertMsg=“请提供/更正以下信息:\r\n”;
var l_Msg=alertMsg.length;
对于(变量i=0;i
包含以下表单的HTML:
<table id="uploadTable" name="uploadTable" class="tablesorter<cfif getcodes.recordcount EQ 0> hidden</cfif>">
<thead>
<tr>
<th>Code</th>
<th>Code Name</th>
<th>Country</th>
<th>Issuing Authority</th>
<th>IA Code</th>
<th>Reference URL</th>
<th>Is Premium</th>
<th>Is Listed</th>
<th>Last Update</th>
<th colspan="2">Actions</th>
</tr>
</thead>
<tr>
<form name="codeAdd" id="designate" method="post" action="codescrud.cfm" onsubmit="return validateAdd(this);">
<td><p><input name="TheCode" maxlength=5 size=7 style="font-size:11px;"></p></td>
<td><p><input name="codename" maxlength=50 size=40 style="font-size:11px;"></p></td>
<td><p><select id="country" name="country">
<option value="Select_Country" selected>---</option>
<cfoutput query="getCountries">
<option value="#country#">#country#</option>
</cfoutput>
</select></p>
</td>
<td><p><input name="IssuingAuthority" size=40 maxlength=200 style="font-size:11px;"></p></td>
<td><p><input name="IssuingAuthorityCode" size=4 maxlength=50 style="font-size:11px;"></p></td>
<td><p><input name="ReferenceURL" size=20 maxlength=255 style="font-size:11px;"></p></td>
<td><p><input type="checkbox" name="IsPremium" class="cbx" id="IsPremium" title="Is Premium?" value="1"></p></td>
<td><p><input type="checkbox" name="IsListed" class="cbx" id="IsListed" title="Is Listed?" value="1" checked></p></td>
<cfoutput><input type="hidden" name="InsertFormUploadKey" id="InsertFormUploadKey" value="1"></cfoutput>
<td colspan="3" align="right"><p>
<input type="submit" name="submit" value="Add New Code" class="button actionBtn" /></p>
</td>
</form>
</tr>
<tbody id="uploadBody">
<cfoutput query="getcodes">
<tr class="uploadRow"><input name="code" value="#code#" type="hidden" class="uploadKey">
<td valign="top"><p><span class="uploadCode">#code#</span></p></td>
<td valign="top"><p><span class="uploadCodeName">#codename#</span></p></td>
<td valign="top"><p><span class="uploadCountry">#country#</span></p></td>
<td valign="top"><p><span class="uploadIssuingAuthority">#IssuingAuthority#</span></p></td>
<td valign="top"><p><span class="uploadIssuingAuthorityCode">#IssuingAuthorityCode#</span></p></td>
<td valign="top"><p><span class="uploadReferenceURL"><cfif ReferenceURL NEQ ""><a href="#ReferenceURL#" target="_blank">link</a></cfif></span><span style="display: none;" class="uploadReferenceURLValue">#ReferenceURL#</span></p></td>
<td valign="top"><p><span class="uploadIsPremium"><cfif getcodes.IsPremium>True<cfelse>False</cfif></span></p></td>
<td valign="top"><p><span class="uploadIsListed"><cfif getcodes.IsListed>True<cfelse>False</cfif></span></p></td>
<td valign="top"><p>#DateFormat(lastupdate)#</p></td>
<td valign="top"><p><button class="button actionBtn deleteUploadBtn" style="width:55px">delete</button></p></td>
<td><p> <button class="button actionBtn editUploadBtn" style="width:55px">edit</button></p></td>
</tr>
</cfoutput>
</tbody>
</table>
代码
代号
国家
发证机关
IA代码
参考网址
保险费是多少
列出
最后更新
行动
---
#国家#
#代码#
#代号#
#国家#
#发布权限#
#发布授权代码#
#参考URL#
真假
真假
#日期格式(上次更新)#
删除
编辑
首先,你知道在2016年1月吗?因此,如果它在IE8、IE9或IE10中不起作用,我不会担心它。其次,请共享一些HTML,比如表单与表的关系在哪里?我使用的是IE11(尽管我添加了IE小于8的检查,删除这些代码行没有任何效果).下表显示了表格的第一行:首先,你知道在2016年1月吗?因此,如果它在IE8、IE9或IE10中不起作用,我不会担心。其次,请分享一些HTML,比如表格与表格的关系在哪里?我使用的是IE11(虽然我添加了IE小于8的检查,但删除这些代码行没有任何效果)。下表显示了表格第一行的表单: