Today do a project, the art is placed in the form (no add runat=server), because of the use of server control, so here to add, or error, the key section of the DIV code is:
<form id= "Form_register1" runat= "Server" name= "Form_register1" > <%--action= "#" method= "POST" >--%>
<div> user name: <input type= "text" id= "Txtuser" runat= "Server" Name= "Txtuser"/></DIV>
< div> Password: <input type= "password" id= "Txtpass" runat= "Server" Name= "Txtpass"/></DIV>
<div class= " RBPORC,
<asp:radiobuttonlist id= "rblist" runat= "server" repeatdirection= "horizontal"
width= "130px"
<asp:listitem value= "0" > Personal </asp:listitem>
<asp:listitem value= "1" > Unit </asp: Listitem>
</asp:RadioButtonList> </div>
<div><asp:button id= "Button1" cssclass= " Next_step_register "runat=" Server "
onclientclick=" return chk_form_register2 (' #form_register1 ') "text=" Login "
onclick= "Button1_Click"/></DIV>
<%--<div class= "Next_step_register" onclick= "chk_form_ Register1 (' #form_register1 ') > Login </div>--%>
</form>
The JS code is:
function Chk_form_register2 (obj) {
if (obj). Find ("#txtUser"). val () = = "" | | $ (obj). Find ("#txtPass"). val () = = "" | | (!$ (obj). Find ("Input[type=radio]"). Is (": Checked"))
) {
Alert ("Please fill in complete");
return false;
}
JS code which has been return false, but debugging, but also Allert, but the prompt after the automatic submission; solution is in onclientclick= "return Chk_form_register2 (' #form_register1 ')" , plus return, i.e.
Return Chk_form_register2
JS code used in DIV+CSS note return