javascript ÕýÔò±í´ïʽ
JSµÄÕýÔò±í´ïʽ
//УÑéÊÇ·ñÈ«ÓÉÊý×Ö×é³É
function isDigit(s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}
//УÑéµÇ¼Ãû£ºÖ»ÄÜÊäÈë5-20¸öÒÔ×Öĸ¿ªÍ·¡¢¿É´øÊý×Ö¡¢“_”¡¢“.”µÄ×Ö´®
Java´úÂë
function isRegisterUserName(s)
{
var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;
if (!patrn.exec(s)) return false
return true
}
function isRegisterUserName(s)
{
var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;
if (!patrn.exec(s)) return false
return true
}
//УÑéÓû§ÐÕÃû£ºÖ»ÄÜÊäÈë1-30¸öÒÔ×Öĸ¿ªÍ·µÄ×Ö´®
Java´úÂë
function isTrueName(s)
{
var patrn=/^[a-zA-Z]{1,30}$/;
if (!patrn.exec(s)) return false
return true
}
}}
//УÑéÃÜÂ룺ֻÄÜÊäÈë6-20¸ö×Öĸ¡¢Êý×Ö¡¢Ï»®Ïß
<PRE class=java name="code">function isPasswd(s)
{
var patrn=/^(\w){6,20}$/;
if (!patrn.exec(s)) return false
return true
}
</PRE>
<BR>
<BR>//УÑéÆÕͨµç»°¡¢´«ÕæºÅÂ룺¿ÉÒÔ“+”¿ªÍ·£¬³ýÊý×ÖÍ⣬¿Éº¬ÓГ-”
<BR><PRE class=java name="code">function isTel(s)
{
//var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?(\d){1,12})+$/;
var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
if (!patrn.exec(s)) return false
return true
}
</PRE>
<BR>
<BR>//УÑéÊÖ»úºÅÂ룺±ØÐëÒÔÊý×Ö¿ªÍ·£¬³ýÊý×ÖÍ⣬¿Éº¬ÓГ-”
<BR><PRE class=java name="code">function
Ïà¹ØÎĵµ£º
ÎÒÃÇ¿ÉÒÔʹÓà JavaScript À´´´½¨¶¯Ì¬µÄͼÏñ¡£
ʵÀý
°´Å¥¶¯»
ÀûÓÃÁ½¸ö²»Í¬µÄʼþÀ´Çý¶¯Á½¸öÏàÓ¦µÄº¯Êý£¬À´Çл»Á½ÕŶÔÓ¦µÄͼƬÒÔ´´Ôì³ö¶¯»Ð§¹û¡£
JavaScript ¶¯»
ʹÓà JavaScript ´´½¨¶¯Ì¬Í¼ÏñÊÇ¿ÉÐеġ£
ÇÏÃÅ
ÊÇ£ºÊ¹Óà JavaScript ͨ¹ý²»Í¬µÄʼþÀ´Çл»²»Í¬µÄͼÏñ¡£
ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÎÒÃÇÒªÖÆ×÷Ò»¸ö³äµ±Á ......
ͼÏñµØͼָµÄÊÇ´øÓпɵã»÷ÇøÓòµÄͼÏñ¡£
ʵÀý
¼òµ¥µÄ HTML ͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùûÓÐÌí¼Ó JavaScript µÄͼÏñÓ³Éä¡£
Ìí¼ÓÁË JavaScript µÄͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùÌí¼ÓÁË JavaScript µÄͼÏñÓ³É䣬µ±Êó±ê¸¡¶¯ÓÚij¸öÈȵãÉÏʱ£¬»áµ÷Óà JavaScript º¯ÊýÀ´ÏÔʾÈȵãËù¶ÔÓ¦µÄÐÇÇòµÄ¼ò½é¡£
JavaScript ͼÏñµØͼ
ÎÒÃÇÒѾ ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="re ......
/*
ÓÉÓÚjavascriptÊÇÒ»ÖÖÎÞÀàÐÍÓïÑÔ,ËùÒÔÒ»¸öÊý×éµÄÔªËØ¿ÉÒÔ¾ßÓÐÈÎÒâµÄÊý¾ÝÀàÐÍ,ͬһ¸öÊý×éµÄ²»Í¬ÔªËØ
¿ÉÒÔ¾ßÓв»Í¬µÄÀàÐÍ,Êý×éµÄÔªËØÉèÖÿÉÒÔ°üº¬ÆäËûÊý×é,ÕâÑù¾Í¿ÉÒÔ´´½¨Ò»¸ö¸´ÔÓµÄÊý×éÁË.
²¢ÇÒÔÚÕâµãÉÏ˵javascript×÷ΪһÖֽű¾ÓïÑÔ²»Í¬ÓÚÄÇÖÖÑϸñµÄÃæÏò¶ÔÏóµÄc++.c#,javaÁË.¾ßÓиü¸ßµÄÁé»îÐÔ.
*/
/*
ÔÚ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>Admin ManageMenu</title>
&n ......