  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:/ p. ?1 i0 b6 Q" N; t: E4 B% B
<script language="javascript">
) V( f# q( ^1 |9 Efunction IsDigit(cCheck) & w" A4 p- \$ H1 ?' ^- h7 B
{ ; ?' H5 Q/ ?: R" h5 e5 C6 j2 F
return (('0'<=cCheck) && (cCheck<='9')); 5 k; i) C- A: u3 a0 p! P. F
}
. r8 o) e0 }. b( r
3 ^4 m+ \; {0 M5 b: R) n. Vfunction IsAlpha(cCheck) & s! \: b/ M' W8 }# |& `: [( w
{ % @! N* k+ r" L9 {. I6 {
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 7 e9 y; E# `! @
}
% g" j9 j7 z+ } - P# \& D+ D6 y' A
function IsaNull(cCheck) " Q: R; l1 `' g
{
) X8 M- p) x" e) r+ J2 T/ g I2 h return(cCheck != " ")
5 A. ^. N% [+ I4 O1 i3 L }
0 R- h& o# ]2 x3 [, m. s & {% a* [ g; R: w8 M0 n# g S1 A( P. j
function checkform() : q! [' W7 |0 U( f6 R* G
{ 1 {6 y& w" @* Q. A9 q6 d8 k: f8 D* u
id = document.sform1.id.value; 3 Z1 \& n/ G# N, w o6 K
if (id == "")
9 N3 C3 N9 x! i. K( C {
6 [6 C6 W8 g R' E8 p alert("请输入注册名"); 5 ^( q% Y( z0 X5 w
document.sform1.id.focus(); $ f) I# d" _& x- W( Y
return false; 6 ?! i( u: q5 c3 n' y$ a/ x) q
} % C, T; O, H- k* Q* K
8 D" z) V/ Q- N! H; b6 L3 A8 A2 i
for (nIndex=0; nIndex<id.length; nIndex++)
, Q5 J; q* H7 V { 6 W: C& S, X9 `% c8 s, O
cCheck = id.charAt(nIndex); * _" T2 h. ~* s) L8 @
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
- {% a2 q. N- J4 N- ~; \6 g {
" w; j! I9 ~& d8 h1 I5 X* @9 J alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * Q" c; h4 b) D, B$ E& t
document.sform1.id.focus(); % K9 U/ @, m, A# L z8 Y
return false;
7 e& p: m8 h+ _) m0 r* i9 f2 P }
5 _6 S: @6 X4 A } * D2 h/ s# Z6 \1 l$ ?" T* w
chineseid = document.sform1.chineseid.value; 4 Y6 V5 Q& L! C6 g) V( H
if (chineseid == "") s& x. D% b) P6 E
{
$ o3 N' }% g" Z- W6 V alert("请输入中文昵称"); * T. O- a2 j7 I( n$ ~9 P
document.sform1.chineseid.focus();
; I+ M" p) w3 D0 k1 m9 L return false;
# r" S+ ~& j" [: k- Z7 t }
; q0 k- w$ b0 A6 r1 z password = document.sform1.password.value;
( {( H5 R0 h( F6 n if (password == "")
- K; i0 }' a' b) M {
5 ]4 j; v1 p* a# A7 ]' V alert("请输入登陆密码"); , N, `- b* U( U1 y% I* u
document.sform1.password.focus(); 9 `* {9 R1 l' \) o
return false; ) W! a0 _7 U! v; @8 t
} & p/ i% y0 V( C, _7 N1 ?
password1 = document.sform1.password1.value;
: R1 Z% j! @* |# w, |, ? L/ ~. A. A) e if (password>password1) - l. K5 m. R. z, d
{% q: |6 f W0 R$ C
alert("重复密码与登陆密码不相同"); 3 r7 ^! n( Y" h3 C8 N) q3 h# H
document.sform1.password.focus();
6 F! `* l! h- v document.sform1.password1.focus();
3 o! m$ M3 |1 i2 [& {- v return false;
p7 }/ A% p% c# Y- y } 4 ]% Z0 @) t+ {3 f* Z5 u! }/ Q2 L6 b
if (password<password1)
( M; \5 D+ n% p7 h {
& z w; u) D9 y* x6 y alert("重复密码与登陆密码不相同"); ( ~# l( _" m4 S
document.sform1.password.focus(); - D% E( i; s( M/ W
document.sform1.password1.focus(); ' f+ }' o) L5 U9 s) \
return false;
& N8 \) P0 G4 I |; X% ~% e } 7 @ y, y6 P" R7 W
if (document.sform1.email.value == "")
1 S- G! G' P' W9 B { 9 m2 `; R" B: S6 s5 Q" x3 T/ i7 _
alert("请输入您的E-MAIL地址"); : b8 z* J5 t1 _- Z' S
document.sform1.email.focus();
1 U9 j1 d" U# P2 Y# m; W return false;
7 P; |: `9 n' u } 5 x- e- S4 P. A0 _9 c! r4 g: W
; H( _2 N" s0 V- C6 j email=document.sform1.email.value; 7 w4 L6 n3 p6 A* C8 ^8 E' n5 u
emailerr=0 , {" D3 g }2 Z" N8 x: m2 Q3 t
for (i=0; i<email.length; i++)
; P' _ Z/ z5 E( O {
6 o7 I2 c/ ^- L5 |9 H8 U$ x; w if ((email.charAt(i) == "@") & (email.length > 5)) 1 k# T: y4 q) t" P. R
{
5 l+ S* t' {* Q6 M( ~! z) u9 k emailerr=emailerr+1 . s1 E* g, S) [) Q) h& u
} & T& e$ Z3 ~: ?7 q$ u
} $ Q, l4 u; h- z" O) L1 s* R
if (emailerr != 1)
2 f. U/ _) }5 n" \* N6 |/ y8 l( u { ! U& b; E! l& J2 W' r" z8 I% u
alert("请输入正确的E-MAIL地址"); , X: i: d9 X9 \4 ^ U& M; u! M# Y
document.sform1.email.focus();
1 y' ^1 r# n; U" F2 ~" ^- u return false; 0 A( a- {8 o& H7 L: E6 @
}
/ N1 s- v* A7 D- e6 J+ s& O
# j2 c1 k* B% X2 u2 z) A4 h) ?$ C if (document.sform1.checkask.value=="") 4 Q+ C( |7 v, [" | q1 }4 p
{
* }$ M1 w0 V- k: M g0 u4 ?' r5 Y& l alert("密码提示问题不能为空");
( U$ `3 l: }/ S& [* b1 x, Z document.sform1.checkask.focus();
' }: Z& M7 x' \! V% @; } return false; 8 [) H) Q9 N9 I; N
} . W& ]9 a8 R+ D& `) P! G* j" D
if (document.sform1.checkans.value=="")
" W7 }0 [ r; r N4 ? Z { , O- W6 e4 `9 p' l* o( B( ~! @8 o5 W
alert("您的密码提示问题答案不能为空"); $ ]& k" i. P4 D; f9 I, u
document.sform1.checkans.focus(); . O5 `: b# }! G+ ]0 g
return false; & h9 G' Q, n( @, J: J0 A
}
3 h. N2 }" e8 @" S9 Y return true; ; a+ f$ f b; k# H( K
3 c- m: S+ x+ q5 L4 J4 \} 5 ?9 p4 D3 t( Y$ e, x( O q7 u
</script> |
|