这就是我包含文件的方式:
net.Conn
使用此调用从= tablesorter'表中的表单调用ValidateAdd函数(codes_scripts.js)==> onsubmit =“return validateAdd(this);在IE中没有任何反应,但它在Chrome和Firefox中运行良好。如果我移动包含此表单的行,在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/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>
包含表单的HTML:
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)
}