|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14399
- 金币
- 2485
- 威望
- 1647
- 贡献
- 1433
|
这个脚本对你可能有帮助:% d% \; ~: o8 |9 y n) z% d3 Y
<script language="javascript">
& x1 n( q( t5 ]function IsDigit(cCheck)
% ~ w4 w# m. V j! @; i {
i2 t+ U8 o! b X% q% A return (('0'<=cCheck) && (cCheck<='9')); ]4 h, w- ~0 P; ?
} # v8 g6 t6 j5 v3 o% p* y( s
1 b8 E8 V3 @. r. ?4 N8 dfunction IsAlpha(cCheck)
$ I+ a8 f$ H! l* J- B { ; n, ~6 T. T7 c5 Y! s! H
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) & D; A% V$ V8 E
}
6 N9 c3 ^1 e- [7 y O* \( x# S
( N0 |7 F/ W( h( M bfunction IsaNull(cCheck)
1 }9 z9 ~- {) t- u {
6 Q+ A# U$ T/ r7 m5 F6 }( F; v return(cCheck != " ")
- v9 O: |0 C- _- q } 9 T& Y0 j7 a0 o, C1 l" F
. R* ]' S$ {& j2 Z2 a( b, q
function checkform()
# x7 ]9 D9 f9 H& Y5 o{ 8 R# h* x; D; _5 t$ K
id = document.sform1.id.value;
* U; O1 Z0 x' E9 b' B; N9 P% `7 Y+ E if (id == "")
. H! Y7 o5 u3 `2 M' v { % q) m7 f* S3 G7 ?% D! q, g
alert("请输入注册名");
0 n6 G$ M$ p# P/ m" e' c) j' H Z document.sform1.id.focus();
2 U9 B6 K3 P$ }# ~; V: m/ Y& a return false;
2 u. h" a% @: p( v; Q# E3 M } : B# ]% u* m: W/ l/ b+ i9 u" a ~4 M
* ?, A; t( Q2 A3 }) S for (nIndex=0; nIndex<id.length; nIndex++)
. A& N; U, a! Q* p: V, ^: w {
" b5 j1 Q' e* \; ?. T& F- T+ q cCheck = id.charAt(nIndex); ! K+ ^; z5 R% V6 E
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) j8 c" K* t9 [% `8 g& y
{ . T* o3 d: c7 c6 E
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); I7 u: M' l$ P4 j+ e9 q. z
document.sform1.id.focus(); " }+ Q, u9 F. ] {: J
return false; % v' X4 n1 U3 ?4 y% t* T. u
}
* c! z3 o& R4 q* z }
; f, y) @$ A, F# v' U chineseid = document.sform1.chineseid.value;
- K& G' c/ r$ i& L( Q if (chineseid == "") ! x" N+ K' P4 Q2 N4 `
{
. x3 C/ Q. |+ U$ Y alert("请输入中文昵称");
$ q/ V# }2 U% m: d8 A* P# D8 k document.sform1.chineseid.focus(); 0 s* e5 j: s2 ^8 J
return false; & I* W/ y5 O* B& \; @. l
}
8 z6 Q+ y0 W6 \% d password = document.sform1.password.value; 0 c& x( e+ I+ Y8 o
if (password == "") 0 Q; g8 u6 P( O& G5 ]
{
0 N. {- d. V/ h$ W6 ] alert("请输入登陆密码"); ; ~( N9 k& K- s' d9 C' y# B
document.sform1.password.focus(); 9 E* j" R7 Y! ?7 @
return false;
3 K9 K4 M5 U6 Y7 x# H! N& B } + s/ e7 R+ J; P* d
password1 = document.sform1.password1.value;
- X! W& |) H% h if (password>password1)
. i- F8 K5 t6 j: @( j* n: k {; }+ E. L; y2 D2 N3 U* ]
alert("重复密码与登陆密码不相同");
- t$ q) W* s0 s* o4 Z8 }, u document.sform1.password.focus();
4 s5 T7 b# N0 f9 E" {( } document.sform1.password1.focus(); 2 m- P$ E ]- ?) V! o' ^8 k
return false;
6 G, x, ]3 b- Z9 u% g! [) ] } 6 }# l: z% P. T
if (password<password1) 0 @% H9 N0 S+ j- V0 B& @* v. H( ~ p
{5 `* |3 ~) Y* g
alert("重复密码与登陆密码不相同"); 8 q6 a& @& A/ Q& K
document.sform1.password.focus(); , F, U( K: q- G6 {
document.sform1.password1.focus();
5 a/ t% X3 o7 _& c$ v) \ return false;
. ^ D- [: ^3 M& E } 7 E. e' x4 J3 t, Y0 U @
if (document.sform1.email.value == "") A: c/ S# p# w5 u {/ r
{
9 L% ?# H3 K- D E alert("请输入您的E-MAIL地址"); 0 k1 N/ Y: J7 i% k" l% G0 F
document.sform1.email.focus(); : i2 |6 b; H/ T7 s5 c
return false; % [7 V R, w: J6 v
} 6 ]3 B; i& H; p- {1 @2 v
8 q, s1 V+ _: h+ b7 m! [# w0 l
email=document.sform1.email.value; ; L" Z2 h7 q, X' o7 K8 F
emailerr=0 1 \3 L; W p R8 Q
for (i=0; i<email.length; i++) ; ~8 |/ F$ q$ m$ `1 d: j
{ ) ]) Q; t; r3 M8 u
if ((email.charAt(i) == "@") & (email.length > 5))
4 x/ r/ i3 V' }( u6 l- S* v9 ~ { # \' ~( h# ?+ z- K, S6 D
emailerr=emailerr+1 $ V: K X$ _) j3 \( I: f
} . b; j8 G2 P$ s) e: [1 i
}
' y: a$ a# H' g7 K if (emailerr != 1)
% A" @7 ]; q& W {
- u" i! ^( I1 y7 A( S0 e* [ alert("请输入正确的E-MAIL地址"); 5 p' f1 i# j1 I7 u, U* L
document.sform1.email.focus(); 4 S" v+ y. a6 S) L( Z
return false;
! n& ]- g+ {' c }
0 d) G# G. F9 F$ P# F 8 T7 d+ t3 X7 m/ j* Z" x0 G, M4 B
if (document.sform1.checkask.value=="") ! w: I; g. W) f! H. g
{ ' M# Q, x! c3 Y- s" @7 `
alert("密码提示问题不能为空"); w5 o9 ?: j% R/ H$ R; V4 B
document.sform1.checkask.focus(); ! H: ~9 V: A. c
return false; ) q& y3 \/ V3 p) B$ f
} * \+ N7 _4 `, _6 g- M
if (document.sform1.checkans.value=="") 0 [5 m" J! F+ l3 t( C+ x7 G; z5 e* K6 e
{
) w* V1 I7 ?" p' k: J# e# ?$ V+ F alert("您的密码提示问题答案不能为空"); ) {! |: ? i8 S' j, F' ~/ M O
document.sform1.checkans.focus(); 4 _8 C) l7 K! p# N5 F0 S
return false;
2 d W- [" ^0 p" B4 H9 c3 n) q }8 V: Y5 d0 ~' ?0 P5 @
return true;
5 }$ K* ^) P. k& ?: ^
& E! w* r z, A0 q2 i} + |6 H9 k7 C' }% B" z& c. w. }
</script> |
|