易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript简单验证

<html>
  <head>
    <base href="<%=basePath%>">
   
 <script type="text/javascript">
  function check(){
   var name1 = document.form1.name1.value;
   
   var password1 = document.form1.password1.value;
  
   var email = document.form1.email.value;
   
   if(name1 == ""){
    alert("用户名不能为空!");
    return false;
   }
   else if(password1.length<4 || password1==""){
    alert("密码不能少于4位");
    return false;
   }else {
    var idxEmail = email.indexOf('@');
    if(idxEmail <=0 || idxEmail == email.length - 1){
     alert("Email地址格式不合法");
     return false;
    }
   }
  }
 </script>
  </head>
 
  <body>
   <form action="registerOK.jsp" method="post" name="form1" onsubmit="return check()">
    <input type="text" name="name1"/>
    <input type="password" name="password1"/>
    <input type="text" name="email" />
    <input type="submit" value="提交">
   </form>
  </body>
</html>


相关文档:

JavaScript中this关键字使用方法详解

在面向对象编程语言中,对于this关键字我们是非常熟悉的。比如C++、C#和Java等都提供了这个关键字,虽然在开始学习的时候觉得比较难,但只要理解了,用起来是非常方便和意义确定的。JavaScript也提供了这个this关键字,不过用起来就比经典OO语言中要"混乱"的多了。
下面就来看看,在JavaScript中各种this的使用方法有什么 ......

40个轻量级JavaScript库介绍

40个轻量级JavaScript库介绍

流行 JavaScript 库不胜枚举jQuery, MooTools, Prototype, Dojo, YUI这些 JavaScript 库功能丰富加上它们插件几乎能胜任任何工作然而这有代价这些库往往导致你网页尺寸臃肿某些场合如果你只想完成特定工作可使用一些功能更专一轻量库本文介绍了40个非常出色轻量级 JavaScript 库
 
......

107个常用Javascript语句

1.         document.write( " "); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document- >html- >(head,body)
4.一个浏览器窗口中的DOM顺序是:window- >(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementB ......

C# Active控件,并触发javascript事件

创建一个Winform用户控件 UserControl1
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......

JavaScript调试、测试和发布工具

在程序员杂志上看到一篇短文《前端开发工具概览》。觉得很有实用价值。现总结如下:
一、调试工具
1.firebug
2.Web Developer Toolbar--调整页面的各个细节
3.IE Developer Toolbar--调试IE的HTML和CSS
4.Companion.JS--调试IE的Javascript
5.Fiddler--Web调试代理,记录本机到互联网的所有HTTP(S)请求。
二、测试工 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号