javascript
html 验证邮箱地址,利用javascript验证邮箱地址是否合法
利用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
&
相關文檔:
New Document2.JS中的注釋為//
3.傳統的HTML文檔順序是:document->html->(head,body)
4.一個瀏覽� ......
Javascript刷新頁面的幾種方法:
1??? history.go(0)
2??? location.reload()
3??? location=location
4??? location.assign(location)
5??? document.execCommand('Refresh')
6??? window.navigate(location)
7& ......
二十、Bookmarklet
1、什么是Bookmarklet?(What's a Bookmarklet?)
Q:什么是Bookmarklet?
A:Bookmarklet是整個都被包含在超鏈接URL中的一小段JavaScript程序。(JavaScript URL就是這個樣子:。)多數瀏覽器允許用戶添加這些JavaScript URL書簽,就像添加其他超鏈� ......
語法
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] )
sURL 可選. URL 字符串 . 如果URL為空, 將以about:blank打開.
sName 可選. 字符串 描述打開窗口的名字(name). 可以做為form 和 a 標簽的TARGET屬性值 .
sFeatures 可選. 字符串 格式如"fullscreen=yes,toolbar=yes".channelmode = { yes | no | ......
總結
以上是生活随笔為你收集整理的html 验证邮箱地址,利用javascript验证邮箱地址是否合法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 武汉理工大学 操作系统复习
- 下一篇: miui12.5 最简单快捷root刷面