|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14413
- 金币
- 2492
- 威望
- 1647
- 贡献
- 1440
|
这个脚本对你可能有帮助:
/ c5 R) J4 S+ z; h: F# `<script language="javascript">
. l, h" A7 r) B6 U1 f# L4 p. H, J5 _function IsDigit(cCheck) ( n) Y0 f& E/ I
{ 6 r6 b. S1 H% U, f3 g' K
return (('0'<=cCheck) && (cCheck<='9')); 1 b/ C8 b8 c: W2 e. S3 T& @; p
} " I# n# @" y) _6 R! C$ W$ u
7 O2 U6 C8 h1 c& G" i1 S6 E: R U
function IsAlpha(cCheck)
4 X( b! j, ^, g8 Y' d" ` {
6 c7 c+ p2 l( |1 _3 e return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ) Y6 j4 S6 J9 y6 Y2 J
} " x# T$ W+ e+ J# q, q
; K; t% D2 _+ N& j/ b: Y# C* z
function IsaNull(cCheck)
8 ~: M% C9 v, z8 f- j: L1 y- L4 ~ { ! R: ^7 @; i; n R# X$ A
return(cCheck != " ")
0 {) E) x8 A9 u" Z( w+ H }
2 y- y" K8 _* Q0 i# |! p( H- u! ^
9 {) U9 o8 G+ q2 ?function checkform()
# F# \" n4 i- X* ?) A' n, y{
# ^+ w5 n7 y) ^/ o+ C id = document.sform1.id.value; : x, Z+ q1 d# C" s, a4 X
if (id == "") ' C6 B/ \* G+ K( ^6 W; Y0 I1 L
{
# F$ K4 N3 a4 h8 c alert("请输入注册名"); " F5 i" n \0 V9 h
document.sform1.id.focus(); . S- I5 ^; m7 U; O: `
return false; % F! o. G) U. H* V1 [& g; Z4 g7 P B
}
$ e* g' e" \) K 1 `3 J. y; B% C7 A
for (nIndex=0; nIndex<id.length; nIndex++)
9 S, l2 s, d, e$ p, l {
* _$ E0 L$ ^4 s% E; U7 H- ` u* V cCheck = id.charAt(nIndex);
2 ~( t4 @1 Y- }" c if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
4 y3 E, W2 B) _1 Y {
3 V% r! Q" k/ {% T9 ]4 I0 | alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
3 H. \! C/ L7 p document.sform1.id.focus(); 6 `4 b, l8 v4 A, \3 d
return false; ) }& O# s- |/ ^' L$ l X- Z6 U
}
% U3 o. e4 X2 }& S }
4 I3 R; w( C" y" A3 a chineseid = document.sform1.chineseid.value;
! w' _# k) n j; L3 k& ^' M if (chineseid == "") ! r1 j; v) k% o( i' j! ]
{ 3 @5 t% z- h, r% r$ q/ c
alert("请输入中文昵称"); ) S. a* e1 g4 b5 v6 [* A" w4 t
document.sform1.chineseid.focus(); ; W/ Z! T8 B( D4 V7 n
return false; 1 _% o& r( z7 Y
} ' N! i" A$ e- o% _7 a
password = document.sform1.password.value;
! @1 d: r+ D1 m F9 b if (password == "") ^5 ^' ]. C) ]
{ 0 }: \1 p3 M8 L2 w. T* e4 ` Q6 {
alert("请输入登陆密码"); n: {4 z# c3 N9 s7 I J" O2 H
document.sform1.password.focus(); ( G5 [3 K& k5 }1 P2 _- A. K8 D" [) G# h
return false;
Q) X) W4 D: l } + [$ J4 Y- L, w* E) N+ |+ W
password1 = document.sform1.password1.value; 0 f+ S5 [0 i# z8 s1 L8 ~: n. b
if (password>password1)
+ f3 \' i$ A8 v3 y4 O {- |5 \4 _4 u; S
alert("重复密码与登陆密码不相同");
+ t- }* `2 l. z8 G% \; t document.sform1.password.focus();
+ F- q. W" h) a5 [( T document.sform1.password1.focus();
- H4 O/ r* Z9 h1 {" e return false;" b4 R' {7 O& i, p3 m
} : w0 \7 o$ O3 u
if (password<password1)
) b' v R$ w5 J. q% Q _7 d, n# S {; J# k3 l9 A# d; l/ k6 a
alert("重复密码与登陆密码不相同");
$ w2 P i. e+ k4 E& u- \; N document.sform1.password.focus(); - _4 v& y7 z) d+ C9 b# \. V
document.sform1.password1.focus();
2 b$ Y4 k" l8 s: d0 G return false;
$ M' B/ e* G i/ A( x; W } 3 H! o6 H+ z2 i
if (document.sform1.email.value == "")
# C6 B6 a0 Y& J L" W& X( } v { , S1 E2 x1 ]# w( N O$ ?" d. v# U
alert("请输入您的E-MAIL地址");
2 i& N- h) }) u2 H. t: i6 a9 D document.sform1.email.focus(); 6 u+ W1 s7 K" N3 d; J. ~8 ^; Y
return false;
7 O8 L! h% N* l. r6 y! l/ K } ( L8 Y( P3 f3 `7 t
& |% e g+ A6 \( _. K% g9 O email=document.sform1.email.value; 9 r0 i; ?! q0 s8 q# c
emailerr=0 : z! A6 i- }1 g9 r
for (i=0; i<email.length; i++) : X- r3 a' A1 z
{ 1 ^5 M& g0 V- C+ O8 V4 ]
if ((email.charAt(i) == "@") & (email.length > 5)) & @5 }% e$ M* V6 B9 H- c8 T
{ . _+ ?& B2 W# W4 i! p
emailerr=emailerr+1
) Q7 W0 Z. h5 j0 J4 P } # D6 C5 |( A) N4 F- n& a2 M& ]! g
}
; ^: Y9 ~5 S; H# k$ c7 `) g4 g5 Z if (emailerr != 1)
, Y) j$ D# w7 x) A* j { 8 E: x3 F$ {+ }& R4 V! Y
alert("请输入正确的E-MAIL地址"); 8 v% I) ~* _& w' J
document.sform1.email.focus();
; W9 C6 a8 x) ^9 D/ n return false; 6 n- v/ \2 {2 c6 m
}
; t- C& ^# S% P. b( ]9 e
9 f5 n+ a6 J" ]% x, D: E if (document.sform1.checkask.value=="") ) X! ^9 g$ y& F# a W3 F
{ 5 T7 |, g& Z7 y K" J
alert("密码提示问题不能为空"); 4 r/ F( P2 I0 X
document.sform1.checkask.focus(); 9 r1 W& u; g* B% B
return false; 7 b1 S; l* [ |# ]! c+ ]: n, d
} : O4 L( j; H7 d; K3 ?( z0 V
if (document.sform1.checkans.value=="")
b4 h2 k$ d8 R; C { 8 L& S* k; P* A8 K2 l4 q
alert("您的密码提示问题答案不能为空");
$ n) q7 a w) |+ ^9 j document.sform1.checkans.focus();
5 k" D1 e2 k% W( ?$ p return false; 2 G' j. @3 F/ F% M; H
}
9 W1 N* O* a; _5 \5 |: J, V return true;
/ x& y+ k7 H/ |% a$ t) |9 m9 Y
) v; L. C1 \- G+ V0 S; v$ x} 5 I, V2 ]4 E6 e8 x! n: _8 R: P
</script> |
|