在form头增加了onsubmit="return checkForm();"方法,提交时可以正常alert,但是return false照样提交,请高手指点啊!JS方法:
function checkForm(){
var orgName = submitForm.ORG_NAME.value;
alert('ggggggggggggggggggg---->'+orgName);
submitForm.ORG_NAME.focus();
return false;
}
body代码:
 <body>
   <table  border="0" cellspacing="0" cellpadding="4" style="margin:10px 0px 0px 10px;width:98%">
  <tr>
    <td width="2%" align="center" class="t2"><img src="<html:rewrite page='/images/arrow.gif'/>" width="16" height="16"></td>
    <td width="97%" class="t2">
    <c:choose>
     <c:when test="${type=='update'}">更新客户机构资料</c:when>
     <c:otherwise>新增机构成员资料</c:otherwise>
    </c:choose>
    </td>
  </tr>
</table>
   <form id="submitForm" name='submitForm' action="<html:rewrite page='/ibsZQ.do'/>" method="post" onsubmit="return checkForm();">
   <table border="0" cellpadding="4" cellspacing="1" style="margin:10px 0px 0px 10px;width:80%;background-color:#9ECFE7">
   <c:if test="${type=='update'}">
     <tr bgcolor="#FFFFFF">
     <td align="right">机构标识</td>
     <td align="left"><input id='ORG_ID' name='ORG_ID' value="${d.ORG_ID}" readonly></td>
     </tr>
     </c:if>
     <tr bgcolor="#FFFFFF">
     <td align="right">机构类型</td>
     <td align="left"><select id='ORG_TYPE' name='ORG_TYPE' onchange="changeOrgType();return false;"></select></td>
     </tr>
     <tr bgcolor="#FFFFFF">
     <td align="right">机构名称</td>
     <td align="left"><input id='ORG_NAME' name='ORG_NAME' value="${d.ORG_NAME}" class="required" title="不能为空!"></input></td>
     </tr>
    
     <c:if test="${type=='update'}">
     <tr bgcolor="#FFFFFF">
     <td align="right">状态</td>
     <td align="left"><select id='STATE' name='STATE'>
     <option value="F0A" <c:if test="${'F0A'==d.STATE}">selected</c:if>>有效</option>
     <option value="F0B" <c:if test="${'F0B'==d.STATE}">selected</c:if>>无效</option>
     </select>
     </td>
     </tr>
     </c:if>
     <tr bgcolor="#FFFFFF">
     <td align="right">父机构标识</td>
     <td align="left"><select id='FATHER_ORG_ID' name='FATHER_ORG_ID' style="width:100px"></select></td>
     </tr>
     <tr bgcolor="#FFFFFF">
     <td align="right">规则串</td>
     <td align="left">
     <input id='DIV_RULE' name='RULE' value="${d.RULE}" style="width:400px"></input>
     <input type='button' value="配置"  onClick="setupRuleString();return false;"></input>
     <input type='hidden' id='OLD_ORG_ID' name='OLD_ORG_ID' value="${d.ORG_ID}" >
     <input type='hidden' id='type' name='type' value="${type}"></input>
     <input type='hidden' name='dispatch' value="doCreateOrUpdateCustOrgItem"></input>
    </td>
     </tr>
     </table>
     <c:choose>
     <c:when test="${type=='update'}">
     </c:when>
     <c:otherwise>
     <input type='hidden' id='CUST_ID' name='CUST_ID' value="${CUST_ID}"></input>
     </c:otherwise>
     </c:choose>
     <p>
<div id="loader" align="center" style="display:none"><img src="<html:rewrite page='/images/loading.gif'/>" alt="loading..." />正在保存...</div>
<div id="info" align="center" ></div>

     <p align="center"> 
  <input id="submit" type="submit"  value="保 存" >&nbsp;
  <input name="button" type="button" onClick="window.close()"  value="关闭窗口">
</p>
   </form>
</body>