客户端判断文本框不能为空后不进入服务端执行

    技术2022-05-20  38

       <script language="javascript" type="text/javascript" >   function CheckTxtBox()   {       var txt=new Array("txt_corpid","txt_corpname","txt_main_business_Range","txt_business_Mode","txt_contact_person","txt_contact_tel","txt_Summary","ddl_service_range","chc_cuiban");        var txttext=new Array("服务商编码不能为空!","服务商名称不能为空!","经营范围不能为空!","经营模式不能为空!","联系人不能为空!","联系电话不能为空!","简介不能为空","请选择经营范围","短信内容不能为空");       for(var i=0;i<txt.length;i++)       {                  if(i!=txt.length-2&&i!=txt.length-1)         {             if(document.getElementById(txt[i]).value=="")              {                alert(txttext[i]);                document.getElementById(txt[i]).select();                event.returnValue=false;                return;              }          }            else if(i==txt.length-1)          {              if(document.getElementById(txt[i]).checked==true)               {                      if(document.getElementById("txt_sms_content").value=="")                     {                             alert(txttext[i]);                          document.getElementById("txt_sms_content").select();                          event.returnValue=false;                          return;                     }                 }          }          else           {              if(document.getElementById(txt[i]).selectedIndex== 0)                alert(txttext[i]);                event.returnValue=false;                return;          }               } } function CheckCorID() {    var txtID=document.getElementById("txt_corpid");    if(txtID.value=="")    {        alert("服务商账号不能为空");        event.returnValue=false;       txtID.select();    } }

     

    弹出页面   function ShowUpLoadFile()  {     var a=new Array(3);    var a=window.showModalDialog("SelectAccount.aspx",0,"dialogWidth:750px;dialogHeight:450px;center:yes;help:no;status:no;rsizable:yes");     if(a!=null)     {          if(form1.txt_corpid)            form1.txt_corpid.value=a[0] ;            if(form1.txt_address)                form1.txt_address.value=a[1];               if(form1.txt_contact_person)               form1.txt_contact_person.value=a[2];                 if(form1.txt_corpname)                    form1.txt_corpname.value=a[3];     }     setTimeout('document.getElementById ("btn_corp_check").click()' ,100 )      }

     

     string id = gv_corplist.SelectedDataKey.Value.ToString();        CompanyAccount account = GetAccountByID(id);        if(account!=null)        {                   Response.Clear();            Response.Write("<script language=javascript> var s=Array(5); " +            "  s[0]='" + account .ComAccount +            "';s[1]='" + account .ComAddr +            "';s[2]='" + account .ComMan+            "';s[3]='" + account.ComName +            "';window.parent.returnValue=s;window.parent.close();</script>");         }


    最新回复(0)