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

利用javascript验证邮箱地址是否合法

源代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>验证邮箱地址合法性</title>
    <script language="javascript" type="text/javascript">
    function EmailAddressTest()
    {
       //获取用户输入的邮箱地址相关的信息
       var EmailString = document.MyForm.MyEmail.value;
       var strLength=EmailString.length;
       var index1=EmailString.indexOf("@");
       var index2=EmailString.indexOf(".",index1);
       var msg="验证邮箱地址的实例:\n\n";
           msg+="    邮箱地址:"+EmailString+"\n";
           msg+="    验证信息:"
       //返回相关的验证信息
       if(index1==-1||index2==-1||index2<=index1+1||index1==0||index2==strLength-1)
       {
           msg+="邮箱地址不合法!\n\n";
           msg+="不能同时满足以下条件:\n";
           msg+="    1.邮件中同时含有'@'和'.'字符;\n";
           msg+="    2.'@'后面必须有'.',且中间至少隔一个字符;\n"
           msg+="    3.'@'不能为第一个字符,'.'不能为最后一个字符。\n";
       }
       else
    &


相关文档:

Javascript调用WebService

<html>
<head>
    <title>Javascript</title>
   
    <script language="Javascript" type="text/javascript">
    function callMethod()
    {
/*http://localhost/waa/WebService.asmx为Servic ......

JavaScript的日期处理

var myDate = new Date();
myDate.getYear();        //获取当前年份(2位)
myDate.getFullYear();    //获取完整的年份(4位,1970-????)
myDate.getMonth();       //获取当前月份(0-11,0代表1月)
myDate.getDate();    ......

javascript调用父窗口的函数和变量


javascript调用父窗口的函数和变量
发布日期:2008-05-28最近更新:2008-05-28来源:BHCODE作者:
web开发的时候,有时候需要使用其他页面上写好的javasript函数、变量。如弹出窗口需要使用父窗口中的函数,框架1需要使用框架2中的函数。
调用函数、变量的方法一样,都是需要首先获得你需要调用的函数所在的window对象 ......

Javascript 之apply()

1、对象的继承,一般的做法是复制:Object.extend
prototype.js的实现方式是:
Object.extend = function(destination, source){
for (property in source) {
destination[property] = source[property];
}
return destination;
......

JavaScript prototype 属性

定义与用法
The prototype property allows you to add properties and methods to an
object.
prototype属性允许你向一个对象添加属性和方法
Syntax
语法
object.prototype.name=value
Example 1
实例
In this example we will show how to use the prototype property to add a
property to an object:
在下 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号