<from name="form1" action="" method="post">
您的大名:<INPUT type="text" name="name1"> <font color="red">*</font><br>
<input type="submit" value="确定" onClick="if (name1.value==''){ alert('请输入你的大名!');return false;}">
<input type="reset" value="重填">
</from>
您的大名:<INPUT type="text" name="name1"> <font color="red">*</font><br>
<input type="submit" value="确定" onClick="if (name1.value==''){ alert('请输入你的大名!');return false;}">
<input type="reset" value="重填">
</from>
解决方案 »
- document.getElementByid()配合getElementsTagName()使用问题
- iframe select 焦点 问题
- 有人懂jquery吗帮忙看看
- help!!
- 请问如何在缩放一个层时,将层上的控件和图片一同缩放??????急!!!在线等!!
- ie9获得浏览器当前语言环境
- INPUT type=text onChange 一问(IE)
- 请教关于全屏的问题
- 怎样取得用户名?怎样取得客户端的一些资料??
- 怎么样才能使下拉列表框变灰?在线等!!!
- 在浏览网页,出来这么个错误。页面里没有ActiveX等等,都是纯的HTML,JS,CSS.这是为啥那?
- javascrip如何打开一个新的进程?
应该这样写吧
这是我的原程序<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%><html>
<head>
<title>留言</title>
<script language="javaScript">
function result()
{
if (document.form1.name1.value=="")
{
alert("请输入你的大名");
}
}
</script>
</head>
<body>
<center>
<from name="form1" action="javascript:login()" method="post">
您的大名:<INPUT type="text" name="name1"> <font color="red">*</font><br>
您的OICQ:<input type="text" name="qq"><br>
您的邮箱:<input type="text" name="mail"><br>
您的主页:<input type="text" name="page"><p>
留言内容:<br><textarea name="content" cols=50 rows=6></textarea><br>
<input type="submit" value="确定" onSubmit="result();">
<input type="reset" value="重填">
</from>
</center>
</body>
</html>
改为
<input type="submit" value="确定" onClick="return result();">result函数改为:
function result()
{
if (document.form1.name1.value=="")
{
alert("请输入你的大名");
return false;
}
}
{
if (document.form1.name1.value=="")
{
alert("请输入你的大名");
return false;
}
return ture;
}
<head>
<script language="javaScript">
function result()
{
if (document.getElementById("name1").value=="")
{
alert("请输入你的大名");
}
}
</script>
</head>
<body>
<from name="form1" action="" method="post">
您的大名:<INPUT type="text" name="name1" id="name1"> <font color="red">*</font><br>
<input type="submit" value="确定" onClick="result();">
<input type="reset" value="重填">
</from>
</body>
</html>换成这样试试
全ajax+.NET构建的大型商务社区站点实现高速缓寸和高速访问速度
值的学习
写的有问题,应该写if(name1.value=="")就可以了。