input非空检查

tianwailiuxingy 2009-10-08 12:39:29
[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,"<", "<")
cs_biaoti = Replace(cs_biaoti,">", ">")

yuanbao=rsa("cs_yuanbao")


zongfenlei=rsa("cs_zongfenlei")
zongfenlei = Replace(zongfenlei,"<", "<")
zongfenlei = Replace(zongfenlei,">", ">")

cifenlei=rsa("cs_cifenlei")


email=rsa("cs_email")
email = Replace(email,"<", "<")
email = Replace(email,">", ">")

wenti=rsa("cs_wenti")
wenti = Replace(wenti,"<", "<")
wenti = Replace(wenti,">", ">")

nicheng=rsa("cs_nicheng")
nicheng = Replace(nicheng,"<", "<")
nicheng = Replace(nicheng,">", ">")


%>

<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,"<", "<")
huifu = Replace(huifu,">", ">")
huifu = Replace(huifu,"\n","<br>")

huifu = Replace(huifu,CHR(10), "<BR> ")
huifu = Replace(huifu,CHR(32), " ")
huifu = Replace(huifu," ", " ")
%>
<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]
...全文
119 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sy_binbin 2009-10-08
  • 打赏
  • 举报
回复
你这个文件里有2个check函数

把没有的那个去掉或者改成别的名字
行间 2009-10-08
  • 打赏
  • 举报
回复
没看到 VBS
tianwailiuxingy 2009-10-08
  • 打赏
  • 举报
回复
我想在提交时检查arra的值为非空,怎么不行啊,高手请给检查一下错误
tianwailiuxingy 2009-10-08
  • 打赏
  • 举报
回复
3楼的太对啦

4,008

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧