首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

input非空检查解决方案

2012-03-09 
input非空检查[codeVBScripmeta http-equivContent-Type contenttext/html charsetgb2312 /ti

input非空检查
[code=VBScrip<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>悬赏科技</title>
<link href="css.css" rel="stylesheet" type="text/css">
 <script language="JavaScript">
function check()

if(document.yuanbao.arra.value == "" || document.yuanbao.arra.value == null)
{  
alert("用户名不能为空!");
document.yuanbao.arra.focus();
return false;
}
//return true
}
</script>
</head>

<body>

<!-- #include file="top1.asp"-->
<div id="mid">
  <div id="left">
<%
 
  if (request("xuanshang_id")<>"") then
   
xuanshang_id=request("xuanshang_id")
response.Write(bianji_id)
end if
strquery = "select * from shangjinkexuejia where cs_id='"&xuanshang_id&"' "
  set rsa = conn.execute(strquery)
if rsa.bof and rsa.eof then
response.Write"没有记录"
else
cs_biaoti=rsa("cs_biaoti")
cs_biaoti = Replace(cs_biaoti,"<", "&lt;")
  cs_biaoti = Replace(cs_biaoti,">", "&gt;")
 
yuanbao=rsa("cs_yuanbao")
 
 
zongfenlei=rsa("cs_zongfenlei")
zongfenlei = Replace(zongfenlei,"<", "&lt;")
  zongfenlei = Replace(zongfenlei,">", "&gt;")
 
cifenlei=rsa("cs_cifenlei")
 
 
email=rsa("cs_email")  
email = Replace(email,"<", "&lt;")
  email = Replace(email,">", "&gt;")
 
wenti=rsa("cs_wenti")  
wenti = Replace(wenti,"<", "&lt;")
  wenti = Replace(wenti,">", "&gt;")
 
nicheng=rsa("cs_nicheng")
nicheng = Replace(nicheng,"<", "&lt;")
  nicheng = Replace(nicheng,">", "&gt;")
 
 
%>
 
  <table border="1" width="100%" id="table1">
<tr>
<td align="left">标题</td>
<td align="left">悬赏元宝</td>
<td align="left">总分类</td>
<td align="left">次分类</td>
<td align="left">email</td>
</tr>
<tr>
<td align="left"> <%=cs_biaoti%></td>
<td align="left"> <%=yuanbao%></td>
<td align="left"> <%=zongfenlei%></td>
<td align="left"> <%=cifenlei%></td>
<td align="left"> <%=email%></td>
</tr>
</table>
 
 
 
 
 
<table width="100%" border="1">
  <tr>
  <td width="134"><img src=<%=rsa("cs_touxiang")%> width="80" height="80"><br><%=nicheng%> </td>
  <td width="658"><%=wenti%> </td>
  
  </tr>
  
  
  </table>

  <p\>


  <%
sql="select * from xuanshanghuifu where h_xuanshang_id= '"&xuanshang_id&"'"
set rs = conn.execute(sql)
If rs.Eof And rs.Bof Then
%>
  

  <%
response.write "没有回复"&"<br>"
else
'while (not rs.eof)
n=rs.recordcount
dim array()
redim array(n)
if not rs.eof then
%>
  <script language="JavaScript">
 
 
 
 function xianshi(a,b )

  array(a)= document.form1.(arra<%=cstr(a)%>).value  
  aa=0
for j=1 to a-1
aa=aa+array(j)
next
bb=b-aa
return bb

}
 
 
 </script>  




  <form name="yuanbao" method="post" action="jiezhang.asp" onsubmit="return check()" >
  <input type="hidden" name="huifushu" value="<%=n%>"> 
 
<table width="100%" border="1">
   
  <% 
   
  'for i=1 to n
  %>
  <%
  huifu = rs("h_huifu")
  huifu = Replace(huifu,"<", "&lt;")
  huifu = Replace(huifu,">", "&gt;")
  huifu = Replace(huifu,"\n","<br>")
 
huifu = Replace(huifu,CHR(10), "<BR> ")
huifu = Replace(huifu,CHR(32), "&nbsp;") 
huifu = Replace(huifu," ", "&nbsp;")  
  %>
  <tr>
  <td width="134" height="123" rowspan="2"><img src=<%=rs("h_touxiang")%> width="80" height="80"><br>
   
<%=rs("h_nicheng")%> </td>
  <td height="81"><%=huifu%></td>
  </tr>
  <tr>
  <td height="28">
<table width="144" border="0" align="right" id="table4">
  <tr>
  <td width="26"><font size="2"><%=i%></font></td>
  <td width="33"><font size="2">元宝</font></td>
  <td width="73"><font size="1">
  <input name="arra" size="9" type="text" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
<% if rs("h_nicheng")=nicheng then%>
value="0"  
readonly="true"
title="不能付费给自己"
 
<% end if%> \>
  </font></td>
  </tr>
  </table>
</td>
  </tr>
  <% 
 
  'rs.MoveNext
  'next
 
  %>
  <tr>
  <td><input type="submit" name="Submit" value="支付元宝"></td>


  <td> <input type="reset" name="Submit" value="重置"></td>
  </tr>
</table>
<P>
 

  </form>
  
 

  
<%
end if
rs.Close
Set rs = Nothing
Set objPage = Nothing
%>
   
 
 
 
 
 
  <%
rsa.close 
  set rsa = nothing
%>
  <%end if%>
<%end if%>
<script language="JavaScript">
//最大字数检测
function check()

if(document.huifu.T1.value=="" || document.huifu.T1.value==null)
{  
alert("昵称不能为空!");
document.huifu.T1.focus();
return false;
}

if(document.huifu.huifu.value=="" || document.huifu.huifu.value==null)
{  
alert("请录入回复!");
document.huifu.huifu.focus();
return false;
}

}


function limitChars(id, count)
{  
  var obj = document.getElementById(id);  
  if (obj.value.length > count){  
  obj.value = obj.value.substr(0, count);  
  }  
}
</script>
<p>
回复(200字)
<form action="xuanshanghuifuxinxi.asp" name="huifu" onSubmit="return check()" method="post">  
  <input type="hidden" size="20" name="id" value="<%=xuanshang_id%>">
  <input type="hidden" size="20" name="biaoti" value="<%=cs_biaoti%>">
  
 
<table border="0" width="100%" id="table3">
<tr>
<td> 回复</td>
<td>
  
  <textarea name="huifu" cols="87" rows="18" id="huifu" onKeyDown="limitChars('huifu', 400)" onChange="limitChars('huifu', 400)" pertychange="limitChars('huifu', 400)"></textarea></td>
</tr>
</table>
  <p>
  <input name="" type="submit" value="提交" />
  <input type="reset" name="Submit" value="重置">
</p>
</form>
  </div>  
  <div id="right">
  <!-- #include file="right1.asp"-->
   


  </div>
</div>  

<!-- #include file="yejiao.asp"-->
 
</body>
</html>t][/code]

[解决办法]
你这个文件里有2个check函数

把没有的那个去掉或者改成别的名字

热点排行