社区
ASP
帖子详情
怎样验证我当前的Text框是否为空?
huang_2
2002-08-01 10:41:15
我原先的做法就是把form提交后再检查上一个页面的某个框是否为空,能否在我点击提交按钮的时候立即检查当前输入框是否为空,并且弹出一个提示框
...全文
85
12
打赏
收藏
怎样验证我当前的Text框是否为空?
我原先的做法就是把form提交后再检查上一个页面的某个框是否为空,能否在我点击提交按钮的时候立即检查当前输入框是否为空,并且弹出一个提示框
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zhuyuantan
2002-08-01
打赏
举报
回复
form 表单里面有个 onsubmit="return function()" 的东东
return false 和return true 表示该 function() 返回真或假
如果返回真就执行 form 表单的 action 动作, 返回假就不执行 action 动作
huang_2
2002-08-01
打赏
举报
回复
return false 和 return true 分别起什么作用?
huang_2
2002-08-01
打赏
举报
回复
太感动了,这么多热心人
JavaCoffee
2002-08-01
打赏
举报
回复
<input type="text" name="txttest" size="20" onblur="if (this.value=='') alert('不能为空!');">
MeXP
2002-08-01
打赏
举报
回复
更正
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript>
function checkdata()
{
if (form1.aaa.value=="")
{
form1.aaa.focus();
alert("Please input");
return false;
}
else
return true;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<form name="form1" method="post" action="" onsubmit="return checkdata()">
<input type="text" name="aaa" >
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
yhncom_36de
2002-08-01
打赏
举报
回复
给你一个例子,很实用的,可要给分呀!把代码粘贴后运行:代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.username.value=="")
{
alert("请输入用户名!");
theForm.username.focus();
return (false);
}
return (true);
}
//--></script>
<table cellpadding=0 cellspacing=1 border=0 align=center>
</table>
<form method="POST" action="file:///C:/Inetpub/wwwroot/web/addok.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<table border=1 cellspacing=0 width=750 height="12" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">
<tr>
<td class=p2 align=right width="167" height="1"><font color=FF9933>*</font>用户名</td>
<td class=p2 align=right width="6" height="1"> </td>
<td bgcolor=E5E6D3 width="7" height="1"> </td>
<td bgcolor=E5E6D3 width="241" height="1"><b>
<input name=username size=25 type=text maxlength=14 style="font-size: 12px"></b></td>
<td class=p2 bgcolor=E5E6D3 nowrap width="313" height="1">用户名最多为10个字符或数字</td>
</tr>
</table>
<hr align=center noshade width=100% color=black>
<p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重写" name="B2"></p>
</form>
</body>
</html>
meizz
2002-08-01
打赏
举报
回复
<form onsubmit="return cc()">
<input type=text name=tt>
<input type=submit value=ok></form>
<script language=javascript>
function cc()
{
if (document.all.tt.value=="")
{
alert("输入框不能为空");
document.all.tt.focus();
return false;
}
return true;
}
</script>
ChinaOk
2002-08-01
打赏
举报
回复
看看faq
grooving
2002-08-01
打赏
举报
回复
javascript:
function check(){
if(document.form1.textbox1.value.length==0){
alert("空");
return false;
}
retrun true;
}
在onsumit事件里return check();
jhlcss
2002-08-01
打赏
举报
回复
If trim(document.all("txtname").value)="" Then
msgbox "不能为空"
End If
jo_yoko
2002-08-01
打赏
举报
回复
<HTML>
<head>
<script language="javascript">
function check()
{
if (form1.txt.value=="")
{
alert("不得为空");
return false;
}
else
form1.submit();
}
</script>
</head>
<body>
<form name="form1" action="???.asp">
<input type="text" name="txt" ><br>
<input type="button" name="btn" onclick="check();">
</form>
</body>
</HTML>
MeXP
2002-08-01
打赏
举报
回复
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript>
function checkdata()
{
if (form1.aaa.value="")
{
form1.bbb.focus();
alert("Please input");
return false;
}
else
return true;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<form name="form1" method="post" action="" onsubmit="return checkdata()">
<input type="text" name="aaa" >
</form>
</body>
</html>
JavaScript检查表单
是否为空
的函数
循环
验证
javascript页面中不为空项.
javascript
验证
大全
功能说明: 表单的
验证
一直是网页设计者头痛的问题,表单
验证
类 Validator就是为解决这个问题而写的,旨在使设计者从纷繁复杂的表单
验证
中解放出来,把精力集中于网页的设计和功能上的改进上。 Validator是基于JavaScript技术的伪静态类和对象的自定义属性,可以对网页中的表单项输入进行相应的
验证
,允许同一页面中同时
验证
多个表单,熟悉接口之后也可以对特定的表单项甚至仅仅是某个字符串进行
验证
。因为是伪静态类,所以在调用时不需要实例化,直接以"类名+.语法+属性或方法名"来调用。此外,Validator还提供3种不同的错误提示模式,以满足不同的需要。
VB图书管理系统源代码.docx
VB图书管理系统源代码.docx
IOS alertView
IOS alertView控件如何添加文本
框
以及密码
框
,很实用的几行代码
jQuery实现批量判断表单中文本
框
非空的方法(2种方法)
本文实例讲述了jQuery实现批量判断表单中文本
框
非空的方法。分享给大家供大家参考,具体如下: 方法一: [removed] /* * 批量
验证
表单非空 * 需要非空
验证
控件的样式class="mustadd" */ $(".mustadd").each(function(){ if($(this).val() == ''){ alert("该项不可为空!"); $(this).focus(); return false; } }) [removed] 方法二: [removed] //批
ASP
28,409
社区成员
356,971
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章