<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="keywords" content="html,javascript,css">
<script type="text/javascript">
function denglu()
{
var userno=document.getElementById("userno").value;
var userpwd=document.getElementById("userpwd").value;
if(userno=="")
{
return false;
}
else if(userpwd=="")
{
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form id="form1" action="test_login_handle.php" method="post">
<div>账号:<input type="text" id="userno" placeholder="输入用户账号" /></div>
<div>密码:<input type="password" id="userpwd" placeholder="输入用户密码" /></div>
<div><input type="submit" value="登录" onclick="return denglu()" /></div>
</form>
</body>
</html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="keywords" content="html,javascript,css">
<script type="text/javascript">
function denglu()
{
var userno=document.getElementById("userno").value;
var userpwd=document.getElementById("userpwd").value;
if(userno=="")
{
return false;
}
else if(userpwd=="")
{
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form id="form1" action="test_login_handle.php" method="post" onsubmit="return denglu()">
<div>账号:<input type="text" id="userno" placeholder="输入用户账号" /></div>
<div>密码:<input type="password" id="userpwd" placeholder="输入用户密码" /></div>
<div><input type="submit" value="登录" /></div>
</form>
</body>
</html> <<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="keywords" content="html,javascript,css">
<script type="text/javascript">
function denglu()
{
var userno=document.getElementById("userno").value;
var userpwd=document.getElementById("userpwd").value;
if(userno=="")
{
return false;
}
else if(userpwd=="")
{
return false;
}
else
{
document.form1.submit();
}
}
</script>
</head>
<body>
<form id="form1" action="test_login_handle.php" method="post">
<div>账号:<input type="text" id="userno" placeholder="输入用户账号" /></div>
<div>密码:<input type="password" id="userpwd" placeholder="输入用户密码" /></div>
<div><input type="button" value="登录" onclick="denglu()" /></div>
</form>
</body>
</html>

js验证表单并提交的更多相关文章

  1. jquery.validate.js 验证表单时,在IE当中未验证就直接提交的原因

    jquery.validate.js 验证表单时,在IE当中未验证就直接提交的原因 今天利用了jquery.validate.js来验证表单,发现在火狐.谷歌浏览器当中都可以进行验证,但是在IE系列浏 ...

  2. js验证表单大全

    js验证表单大全 1. 长度限制 <script> function test() { if(document.a.b.value.length>50) { alert(" ...

  3. js验证表单密码、用户名是否输入--JS的简单应用

    在登录.注册时,我们经常会遇到下面这种情况,如果我们没有输入用户名.密码时,系统会弹出提示框.提示框信息提示内容是我们密码没有输入密码或者用户名等.那么这样的弹出框效果是如何实现的呢?文章标题既然与j ...

  4. JS 更改表单的提交时间和Input file的样式

    JS转换时间 function renderTime(data) { var da = eval('new ' + data.replace('/', '', 'g').replace('/', '' ...

  5. php通过token验证表单重复提交

    PHP防止重复提交表单 2016-11-08 轻松学PHP 我们提交表单的时候,不能忽视的一个限制是防止用户重复提交表单,因为有可能用户连续点击了提交按钮或者是攻击者恶意提交数据,那么我们在提交数据后 ...

  6. 使用js控制表单重复提交(1加锁,2事件方式,3 EasyUI中解决表单重复提交)

    方法一. var flag = true; $(function() { $("#interested").click(function() { beInterested(); } ...

  7. 使用JS对form的内容验证失败后阻止提交 &&js校验表单后提交表单的三种方法总结

    1.form的两个事件 submit,提交表单,如果直接调用该函数,则直接提交表单 onSubmit,提交按钮点击时先触发,然后触发submit事件.如果不加控制的话,默认返回true,因此表单总能提 ...

  8. js 验证表单 js提交验证类

    附加:js验证radio是否选择 <script language="javascript">function checkform(obj){for(i=0;i< ...

  9. jquery.form.js+jquery.validation.js实现表单校验和提交

      一.jquery引用 主要用到3个js: jquery.js jquery.form.js jquery.validation.js 另外,为了校验结果提示本地化,还需要引入jquery.vali ...

随机推荐

  1. Maven构建SSM架构,并分离层次,使用Maven 组织多项目

    参考http://www.cnblogs.com/quanyongan/archive/2013/05/28/3103243.html一步一步搭建,感谢QuantSeven 1.建好的目录结构 说明: ...

  2. 武汉科技大学ACM :1002: 零起点学算法66——反话连篇

    Problem Description 把输入的字符按照反着顺序输出 Input 多组测试数据  每组一行(每组数据不超过200个字符) Output 按照输入的顺序反着输出各个字符 Sample I ...

  3. C++ Primer 5th 第9章 顺序容器

    练习9.1:对于下面的程序任务,vector.deque和list哪种容器最为适合?解释你的选择的理由.如果没有哪一种容器优于其他容器,也请解释理由.(a) 读取固定数量的单词,将它们按字典序插入到容 ...

  4. C++ Primer 5th 第7章 类

    类的基本思想是数据抽象和封装,定义类就是定义一个抽象数据类型. 类中的所有成员必须在类中声明,也即默认定义在类中的成员全部为声明,除非显式的定义成员函数的函数体.成员函数是在类中声明的,定义可以在类内 ...

  5. $(this).val()与this.value的区别?text()与html()的区别?

    $(this).val()与this.value 作用:都是获得当前Dom对象的value值(一般是表单元素) text radio checkbox select 基本没有什么区别,只是: this ...

  6. KACK的处理方法

    demo: .eq { color:#f00;/*标准浏览器*/ color:#f30\0;/*IE8,IE9,opera*/ *color:#c00;/*IE7及IE6*/ _color:#600; ...

  7. xampp 命令行修改数据库密码

    进入xampp 下 ./mysql -u root -p password 进入mysql控制台 UPDATE mysql.user SET Password=PASSWORD('password') ...

  8. LeetCode _ Word Break

    Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...

  9. LeetCode _ Gas Station

    There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...

  10. delphi线程的创建、挂起、激活与终止(用绘图做实验,简单又好用)

    unit Unit1; interface usesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...