Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÑéÖ¤ÓÊÏä¸ñʽ´úÂë


ÓÃÒ»¸öÕý²à±í´ïʽÔÚjavascriptÖÐÑéÖ¤¾ÍÊÇ¿©!
<script language='javascript'>
function chkMail(){
if(document.form1.email.value=''){
alert("ÇëÌîдÓÊÏ䵨ַ!");
document.form1.email.focus();
return false;
}
//¿ªÊ¼ÑéÖ¤
var email = document.form1.email.value;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
chkFlag = pattern.test(email);
if(chkFlag){
return true;
}
else
{
alert("ÓÊÏ䵨ַµÄ¸ñʽ²»ÕýÈ·£¡");
document.form1.email.focus();
return false;
}
}
</script>
~~~~~~~~~~~~~~~~~~~~~~~Íê±Ï£¡
×î¼òµ¥µÄ¾ÍÒ»¾ä£º
if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test('email'))
{
alert('email²»ÕýÈ·');
}
----------------------------------------------------------------------------------------------------------------------------
js:
function isEmail(email)
{
invalidChars = " /;,:{}[]|*%$#!()`<>?";
if (email == "")
{
return false;
}
for (i=0; i< invalidChars.length; i++)
{
badChar = invalidChars.charAt(i)
if (email.indexOf(badChar,0) > -1) {
return false;
}
}
atPos = email.indexOf("@",1)
if (atPos == -1) {   return false; }
if (email.indexOf("@", atPos+1) != -1) {   return false; }
periodPos = email.indexOf(".",atPos)
if(periodPos == -1) {
return false; // and at least one "." after the "@"
}
if ( atPos +2 > periodPos) {
return false; // and at least one character between "@" and "."
}
if ( periodPos +3 > email.length) {   return false; }
return true;
}
aspx: µ÷ÓÃ:
<input id=zz><input type=button value=check onclick="if(isEmail(zz.value))alert('ÕýÈ·');else alert('´íÎó')">


Ïà¹ØÎĵµ£º

[javascript]¶àÐÐTextBox»Ø³µ»»ÐУ¬¹â±êÒÆµ½×îĩβ

Ò³ÃæÆÁ±ÎÁ˻سµ£¬½á¹û¶àÐÐÊäÈëµÄTextbox±¯¾çÁË£¬Ö»ÄÜÓÃjsÖØÐ´»Ø³µÊ¼þ£¬±¸·ÝÒ»ÏÂ
pageloadÀï
 txt_eng.Attributes.Add("onkeypress", "enter(this)");
js£º
function enter(obj) {
            if (event.keyCode == 13) {
    &nb ......

Javascript´íÎó´úÂë½âÊÍ´óÈ«

JScript ÔËÐÐʱ´íÎó
¡¡¡¡JScript ÔËÐÐʱ´íÎóÊÇÖ¸µ± JScript ½Å±¾ÊÔͼִÐÐÒ»¸öϵͳ²»ÄÜÔËÐе͝×÷ʱµ¼ÖµĴíÎó¡£µ±ÕýÔÚÔËÐнű¾¡¢¼ÆËã±äÁ¿±í´ïʽ¡¢»òÕßÕýÔÚ¶¯Ì¬·ÖÅäÄÚ´æÊ±³öÏÖ JScript ÔËÐÐʱ´íÎóʱ¡£
´íÎóºÅ ÃèÊö
5029 Êý×鳤¶È±ØÐëΪһÓÐÏÞÕýÕûÊý
5030 ±ØÐ븳¸øÊý×鳤¶ÈÒ»¸öÓÐÏÞÕýÊý
5028 ÐèÒª Array »ò arguments ......

ÓÃ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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ÎÞ±êÌâÎ ......

JavaScript ÅжÏÉÏ´«ÎļþÀàÐÍ

function
 Check_FileType(str)
{
 
var
 pos 
=
 str.lastIndexOf(
"
.
"
);
 
var
 lastname 
=
 str.substring(pos,str.length)  //´Ë´¦Îļþºó׺ÃûÒ²¿ÉÓÃÊý×鷽ʽ»ñµÃstr.split(".")
 
if
 (lastname.toLowe ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ