  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14257
- 金币
- 2419
- 威望
- 1647
- 贡献
- 1367
|
这个脚本对你可能有帮助:8 L0 l8 K. u$ N7 U: O i
<script language="javascript">
4 i" N6 P2 e+ U0 yfunction IsDigit(cCheck)
; b: u1 [$ k7 |- N! O { . e+ C. d3 G7 B& e
return (('0'<=cCheck) && (cCheck<='9')); * H$ s5 ^0 @0 X( f& Q! }
}
9 s0 @8 L) ~- Y7 I' W* c( o+ X
# ^" h9 F" K. B' K2 P& O! zfunction IsAlpha(cCheck)
$ ]/ A8 D9 X, M/ x* u {
+ V& K/ d3 \+ z' ~0 K5 [ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
) u: E" D8 V, \ }
- Z1 a, v! \; F) Z# s9 t
7 _! E/ i A" W5 s- u S5 u* Vfunction IsaNull(cCheck) - `. K$ ^. k; ^/ g) U
{ , A( [# l, v# U7 \ P* d
return(cCheck != " ") ) I, V+ G9 k* x/ q# ?. b/ d
} 3 x1 e6 n9 `0 @+ S/ I
, l' x0 \% D* hfunction checkform()
- a' ]" A; k5 s8 @0 \ V{ 1 @0 B7 E) v8 n O
id = document.sform1.id.value; 0 O. C, e6 L }& M% W4 N
if (id == "")
2 v1 m8 ^3 a5 ` d9 z { . U8 }( o2 A6 w9 O
alert("请输入注册名");
# q5 m! m) o* w' e* f. \ document.sform1.id.focus(); ) f& _* ~) {, D* [. N; z) f
return false;
+ q v4 _- f h: R0 ^" t# ` } 9 F# s- n+ }# S5 w- p
( W3 ^0 G. W, a. S for (nIndex=0; nIndex<id.length; nIndex++)
0 {; b* F& }6 x { 0 k0 `- t4 E* ]
cCheck = id.charAt(nIndex);
2 d" C4 r( r4 n U" A! h4 K if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) % S! \, A% Y3 `
{
6 K1 N: u! X: N6 S- A G alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ; U' Z% r; D4 ?/ |, W2 g$ t, u) Q* h
document.sform1.id.focus();
0 i! P; ]$ ?5 T# [; X7 f return false;
! w7 M7 v' y4 Y# Y5 N8 t5 t R }
9 n$ G, ]) ]& E$ D$ g } & P9 v& {& a. O; t8 W2 h
chineseid = document.sform1.chineseid.value;
}0 N) S. a% S; s if (chineseid == "")
" k ], s* b8 I { % |6 `& o% I- d9 Z3 E( @+ J
alert("请输入中文昵称"); ' m# A+ G5 Z# a9 r+ X5 L
document.sform1.chineseid.focus();
8 M% z9 S1 S k4 P0 T return false;
7 M* f* S+ R$ j) Z8 o" W } ; ~3 l$ D% T- F3 g7 `/ q. o. S' D
password = document.sform1.password.value; 3 L# n) t" q2 |; F. |
if (password == "")
1 o3 s3 `( p: Q {
- L u5 T M$ p) s! Q alert("请输入登陆密码");
* A7 H4 y# H3 E" v document.sform1.password.focus();
9 x4 T, T+ m2 B: B4 T5 I# V return false;
! n/ {* N. k5 Z- S6 S, A+ A }
2 A7 ^5 D$ B9 H k+ W+ ?; q2 z! C/ M password1 = document.sform1.password1.value; : u! J3 k" d8 a \+ V- N9 {
if (password>password1) ' i7 x0 U# ?& M. A$ R
{
" c- w5 }* J; ]- m- o& ^ alert("重复密码与登陆密码不相同");
! F" ] w+ T* u5 D4 } document.sform1.password.focus(); ' V9 e9 ]' d" d0 L6 R
document.sform1.password1.focus();
5 J0 [5 R% z8 R4 C9 t9 K return false;
" S9 h. \! z* C } $ E* V/ b% c6 r! X& h+ W, ^
if (password<password1) 2 y) G x# } x, K3 u
{$ V7 {2 U5 N2 ~: J u9 M/ @7 M8 R
alert("重复密码与登陆密码不相同"); # x% E2 g1 t2 {2 L' n8 K
document.sform1.password.focus();
: {8 _% Y' s0 Z4 M2 n6 f6 O! x4 t document.sform1.password1.focus(); 3 M( Q ]+ S8 \8 A8 i) h! P5 Z! s
return false;
1 B3 J" d) h( _0 K' G }
% \, b) f# r7 j if (document.sform1.email.value == "") " g4 m6 n* o% ^% m" d9 D
{
9 m% ?& G+ F' [; V$ @; P alert("请输入您的E-MAIL地址");
" | ?4 D( U2 [+ Q8 ^ document.sform1.email.focus();
. f. P. }& n7 W2 d3 S( e8 f return false;
" i! j3 b! m! i/ E4 h5 M } 0 u3 {4 P- P9 O/ x$ v
9 G2 T5 ?, N: G8 C
email=document.sform1.email.value; : C$ p- K1 z" q
emailerr=0
; `* H. z: N# r2 X* u$ ]. H. M for (i=0; i<email.length; i++) * b# F" ?4 D8 N" ?- j
{ 8 [' c, w3 a: [- W3 d
if ((email.charAt(i) == "@") & (email.length > 5)) ! y! k4 C. |; M( S" a; |
{ / o4 T2 {3 i2 P, L, P
emailerr=emailerr+1
; v8 m" w+ P4 A( f% [- n }
' |* ~% @1 ~4 V' E% x6 w% B }
. P* K" U4 g% Y if (emailerr != 1)
# m, R# t) Y8 n( }& X { & f, ^* C! ?# R3 Z( `2 W$ H
alert("请输入正确的E-MAIL地址"); 7 f3 \( K& V( M9 U0 Q5 d2 H( Y; c* O
document.sform1.email.focus();
3 ^) m6 ^# C( n' W return false; c; _" m* w$ E8 T6 S8 D5 G, |
} 2 Y3 P0 F( j4 z) m0 r
( o2 O6 F! X6 T. L! [3 {4 H: p if (document.sform1.checkask.value=="") - Y P) i% o4 S0 Y; c
{ 4 s* W8 Q+ Z+ Z2 `' a% V9 g% q
alert("密码提示问题不能为空");
6 V/ F% V f' W2 h7 H$ w document.sform1.checkask.focus();
; v5 z& N7 j, }$ G$ i# g/ B return false;
6 D- o6 T1 F4 f8 F7 q } * P" u6 b0 G1 a9 B
if (document.sform1.checkans.value=="")
# r* \0 `. p% B- E# M { : ~1 n: G1 r: R2 d; D, f
alert("您的密码提示问题答案不能为空");
3 q5 s! j& Z6 j" a; d document.sform1.checkans.focus();
1 H3 Z* z W9 z! c. U return false;
: w: o; t, p3 s2 L! r% H }
* Z( E8 F& _. {' g! s6 _ b& d return true;
6 L7 r1 B, ?, k6 w2 u" K5 ~: s T$ y3 y X9 f8 w6 [& e5 i
} % [0 M0 ]/ z# S0 q4 o U
</script> |
|