<!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. android SQLite使用SQLiteOpenHelper类对数据库进行增删查改

    一个简单的例子,当点击按钮时进行相应的操作,效果图如下: 项目代码如下: DatabaseHelper类 package com.example.sqlitedatebasetest; import ...

  2. html中window对象top 、self 、parent 等属性

    window对象用法: http://www.w3school.com.cn/htmldom/dom_obj_window.asp top 属性返回最顶层的先辈窗口. 该属性返回对一个顶级窗口的只读引 ...

  3. 网易JS面试题与Javascript词法作用域说明

    调用对象位于作用域链的前端,局部变量(在函数内部用var声明的变量).函数参数及Arguments对象都在函数内的作用域中--这意味着它们隐藏了作用域链更上层的任何同名的属性. 2010年9月14日, ...

  4. code:blocks 编译环境设置

    1.  支持C99 在菜单settings->compiler settings->comiler settings->Other options 添加: -std=c99 2. 支 ...

  5. css background-position:x% y%

    规则1: background-position:xpx ypx; 为正值时:背景图片的左上顶点朝右下移动直至距离div的左上顶点为xpx ypx: 规则2: background-position: ...

  6. Cocos2d-x 使用物理引擎进行碰撞检测

    [转自]: http://blog.csdn.net/cbbbc/article/details/38541099 通常在游戏简单逻辑判断和模拟真实的物理世界时,我们只需要在定时器中判断游戏中各个精灵 ...

  7. Docker for Windows

    Docker for Windows使用简介 在上一篇文章中,通过演练指导的方式,介绍了在Docker中运行ASP.NET Core Web API应用程序的过程.本文将介绍Docker for Wi ...

  8. Spark运行问题备忘一(网络搜集)

    问题一 ERROR storage.DiskBlockObjectWriter: Uncaught exception -9ca8//shuffle_1_1562_27 java.io.FileNot ...

  9. 06 - 从Algorithm 算法派生类中删除ExecuteInformation() 和ExecuteData() VTK 6.0 迁移

    在先前的vtk中,如vtkPointSetAlgorithm 等算法派生类中定义了虚方法:ExecuteInformation() 和 ExecuteData().这些方法的定义是为了平稳的从VTK4 ...

  10. 转:6款Java转C#的最佳工

    原文来自于:http://designzum.com/2014/03/27/best-tools-to-convert-java-to-c-source-code/ ava is the class ...