|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14325
- 金币
- 2448
- 威望
- 1647
- 贡献
- 1396
|
这个脚本对你可能有帮助:
3 ]; p0 q' s! C# ^ e0 ^<script language="javascript"> , j% y. [! H2 w" q% Z4 W% B
function IsDigit(cCheck)
& b. l& x" z$ s( ?4 u: d9 q$ [ {
% y9 ^/ k5 e" R. f! [8 ]4 N3 Q1 O8 e return (('0'<=cCheck) && (cCheck<='9')); 0 V% h% S" g0 D$ j1 q
} + Q3 x, R, K5 e! q6 N+ ]' k% A' A
3 r! e! m5 Y/ k2 M4 ^function IsAlpha(cCheck)
0 } A+ S( A S( M' Y8 z8 ? { # L' \9 a! r8 ~ i$ C8 y- ~
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
5 e% j$ u4 F2 v/ l1 Y; @ } - f5 V( t" ]1 I
% R$ n, b! [0 S8 Z5 o, I
function IsaNull(cCheck)
/ l+ A* ?% u R- r { * ^9 M0 k0 f, z
return(cCheck != " ") - N, S# a/ ^' K. R; l, Y; z
} * V @9 A9 |* W8 o0 Q; X% W
p' o- h% g$ G% S( F
function checkform() 0 y2 h6 u: s" ~" ?9 H! d {5 k$ p
{ * D! _. k# ~! z# l% d$ X
id = document.sform1.id.value; / Y0 D6 p0 S% @% h# m1 m8 @
if (id == "")
$ H4 X) ^6 z+ F {
2 I5 g" f( J3 r' D; y alert("请输入注册名"); $ P8 k8 V/ }/ l. P7 X- J& x# k
document.sform1.id.focus();
6 |8 m8 R2 x" U& z return false;
% u- Y7 ^! S* E3 ?# j, ^ } * @4 l% N. O1 U* z1 }. v$ H2 P
' A2 j' }( _7 Q) o
for (nIndex=0; nIndex<id.length; nIndex++) & Q( v- i9 p8 X
{
, D$ }# }" }8 Q8 J ~ cCheck = id.charAt(nIndex);
, s0 T) _4 [" ?( R if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
- J' T3 q; M/ R( M2 P% I+ h) I {
! U+ u7 L+ h& W* B# N8 A9 z) d, S( Z alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
2 m: a9 |1 k5 ^! M( I document.sform1.id.focus();
# T6 z) l- X! c# w$ } return false;
& U9 z$ T/ d7 I }
1 m1 n0 S/ \9 S7 o } , e* T- s0 [+ P. i3 W
chineseid = document.sform1.chineseid.value; 3 d) f) W5 [, _5 ? O$ B% F
if (chineseid == "")
+ I$ i3 `" M) Y3 }8 y4 t8 o {
: t1 I) B1 C# R* d' n5 O alert("请输入中文昵称"); ' } t' x1 ~8 q6 o' f2 ?* H
document.sform1.chineseid.focus(); # H3 ?" X9 Y* @: o2 L! `& p6 U
return false; ; ]1 H' E- N- }
}
7 r; A" x% Z4 v password = document.sform1.password.value;
" G( w: a5 |, ^) y1 Z0 N if (password == "")
( V4 p2 `, m; W5 i5 Y { 8 j) w* R' f9 O
alert("请输入登陆密码");
! f/ i2 C9 w" A- d8 X2 |0 L6 ^ document.sform1.password.focus();
$ h) M1 K2 y5 \6 E, Y; O$ W0 \& ? return false; + g( O, x/ \7 i
} * G8 T, s @* ^ ^ l& q) }
password1 = document.sform1.password1.value; 7 u9 v! \( S) E6 X4 M6 u& u
if (password>password1) * Q2 s y8 W# K6 P
{
1 y8 [/ b( t3 f8 Q# H alert("重复密码与登陆密码不相同"); F9 B7 ]" ]$ b& K, I: b* S# K# L3 q+ l
document.sform1.password.focus(); / ]5 W8 T6 N; D9 r7 E+ ~
document.sform1.password1.focus();
; X& s/ j; `/ i' Y return false;7 O. D7 z* i* h1 h `# |, H
}
! n. ^' x3 C$ H- W) bif (password<password1)
5 W' z, ~9 H% o: U! t {
" V. u. Y. v: @" \+ v% x alert("重复密码与登陆密码不相同");
8 v) p/ {" y1 I% E/ ]+ a document.sform1.password.focus(); ! ~+ w8 k5 J5 W- u' u
document.sform1.password1.focus();
* I6 j3 a$ |" y+ i; J. a' G) t( s return false;
$ T7 u- o) r0 Z9 M) k c }
7 e& y" w% W5 V7 N$ f' i9 b if (document.sform1.email.value == "")
7 V1 u x3 T3 g+ U" o3 W {
* d5 _6 H5 G- b" P alert("请输入您的E-MAIL地址"); * t- a0 V. ~: B. s/ \# v5 J
document.sform1.email.focus(); ; {4 J8 }( t2 o) h* `
return false; ' y U: O9 A* |3 y
}
! ^# u; P3 X% w7 d9 Q: ]5 x H5 q9 p) m, u3 }! N
email=document.sform1.email.value;
3 b4 |7 D+ w6 L) O7 ^ emailerr=0
3 ^8 e) Z/ r& Z ^ for (i=0; i<email.length; i++) 2 [& \2 ~( r8 P
{
+ Z# L( ^4 u0 b* x0 Q if ((email.charAt(i) == "@") & (email.length > 5)) : `+ ?5 d6 e' g( Z# b) ^
{ + ?$ ~% D f, B+ ~+ {" g
emailerr=emailerr+1 8 v [0 h6 c5 z6 w
} 5 M9 U; Y x5 }) q7 i! I5 C
}
( w4 \* n3 Z$ l2 S1 q& k; J S6 N8 D+ G if (emailerr != 1)
" m5 t. u& i7 ^: d( L { 3 b2 U! r+ o0 ^, q9 ~
alert("请输入正确的E-MAIL地址"); . v( ^ U* f* ?% R, k- J. X
document.sform1.email.focus(); : y+ @2 I5 k8 J/ p" a! N
return false;
. S( f& F3 V+ `$ M @ } 2 c% I" y+ ?0 T s2 ]
- e; _! z0 R( U1 s4 ^ if (document.sform1.checkask.value=="") 1 u% Y' ^0 t5 Q5 \1 f
{
0 @8 {% V: {% s7 \( \+ |, C alert("密码提示问题不能为空");
" b) Z* U+ `* e0 s( H, o# f document.sform1.checkask.focus(); ) y8 ^( N5 b$ i
return false; \8 F7 y! W7 h) e* f+ ?5 e- q- u
}
( ?0 c$ l8 C( t5 j4 P3 s1 B! \) ` if (document.sform1.checkans.value=="")
; a$ x6 y3 m+ a+ g4 _7 f+ g { 7 V8 ^! z2 B8 A0 }% Q* ?. m
alert("您的密码提示问题答案不能为空"); ' |/ t3 w% B. n: ]* u
document.sform1.checkans.focus();
1 Z9 H o {! w E' S) _) Q8 M# Y return false; + [5 L) a6 B: Q
}
( m0 |* e$ U% ?) y; P* ?' ]+ C return true;
; Z7 t( `, S" ?$ [: b
y, r3 l9 E2 ~; O$ B6 A# H$ J}
8 M. S# t4 w. H1 g+ B</script> |
|