|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:
4 b3 m$ \3 @: U# T! o/ c/ w y<script language="javascript"> 3 r, `+ f. i2 K7 L% O7 b# O# r
function IsDigit(cCheck)
: G6 M" E8 L9 U3 g0 [ u# v { ; [( n9 V$ Q) v6 v
return (('0'<=cCheck) && (cCheck<='9'));
. A# o. X) K: Q4 z$ K3 N }
/ j$ u6 _: `8 e H! {, _ 6 E$ |1 ]$ [7 @( ~$ ~
function IsAlpha(cCheck)
! R: b: C6 [; d# P3 ~6 |6 V' _ { 8 Q0 T$ N& ^8 G; X
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
' O0 M0 o9 |* U9 @0 j- _* f } 6 E J$ N+ a- w. Q1 a) ~' Z$ q
1 c7 t* U* M6 I, L9 ^/ J
function IsaNull(cCheck)
; w: z1 r$ r% y3 t9 f { & ^/ f/ n* E5 x/ r' a" \
return(cCheck != " ") 5 E% B+ p$ V/ W' j$ ~6 v1 ] V
} + j* i7 R1 R2 M7 E2 s7 _/ ?& M
( ^# w8 f+ p6 c% I' o( D
function checkform()
+ B" Y. C0 a- h- x0 t1 @{ 6 ~* L9 S9 z5 P) q; ^
id = document.sform1.id.value;
4 l. V/ G+ s9 J7 g0 e if (id == "")
& h* r. K6 u" H8 Z: P$ i V { 6 b! @( w' B5 @+ m
alert("请输入注册名"); ( ]. B+ B8 p! D4 L) k1 n
document.sform1.id.focus(); & R. R! f2 u( U" |$ V0 ^! M; x1 q
return false; ! T7 g# \5 H9 x5 i
} 6 F: C- o' N Z
7 _" N# h4 W: D
for (nIndex=0; nIndex<id.length; nIndex++)
+ \% s# H7 ~* e6 O {
& K, ]4 ?$ @% R) O" P: K; A cCheck = id.charAt(nIndex); " `& v! X4 s# M6 i& \
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) / {8 w# I' m# E! r0 A7 N8 U
{
) ^! t6 S2 x; m. Y R+ l: m alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
$ |, ^. f# z# r/ b document.sform1.id.focus();
$ D3 Q6 B6 p0 S' ?" t: u return false;
7 \: D* F! H: n( d* S2 q5 A } ( L8 C" d! c1 G+ q; w+ B
}
/ y& R3 w6 W+ K u chineseid = document.sform1.chineseid.value; + P) r4 w9 F1 `$ l# Q6 G" i
if (chineseid == "") 4 ]6 B7 f' l8 d$ M, N) d1 h
{ % t+ t; W6 s$ `& F5 Q- Y& q
alert("请输入中文昵称");
% P6 O- i3 M. K document.sform1.chineseid.focus(); $ o6 L$ W- M) X) x* |5 ~
return false; 9 h, i, m: |' N# I
}
9 x; h+ F& `+ M+ ]) c/ d' B6 J- v" c password = document.sform1.password.value; ! S! T5 p1 Q Z4 P, B5 h) y/ Q
if (password == "") / z: ^) H ]' \! a# p1 y
{ " I- }, U- w( g( Y P
alert("请输入登陆密码"); ; M( Y7 {- g2 N( g; `, _/ c% `! l" _
document.sform1.password.focus();
2 ?( b& J# ~' d return false;
- c& |0 c. Y- W8 g8 v$ E } 3 \9 Q$ v; P! A/ D; D: H2 n
password1 = document.sform1.password1.value; 1 G6 ]2 `8 d6 S G! {( U! }5 W
if (password>password1) 0 b& t9 v+ K+ [) X8 z
{; f; [' r- }4 L( k
alert("重复密码与登陆密码不相同"); 9 v# l8 G4 l, `* I) u& i
document.sform1.password.focus();
! z8 j9 B# M; s) M# r document.sform1.password1.focus(); # h% d; K. t* j) b2 W% d
return false;2 \4 i; J6 K h1 n+ ?! l6 p% k
}
2 \! | S# x2 b" X5 D5 gif (password<password1)
, P& X7 e5 o. T6 O3 V {1 @- U6 E; v+ y" q$ @/ O# \$ s
alert("重复密码与登陆密码不相同");
* s+ u; }1 ?. {' F, Z# B document.sform1.password.focus();
9 c* e5 h% q; _! u3 g document.sform1.password1.focus(); - p# F- B% N5 h' ^( ]& \$ {& D
return false;
/ X: C; ^4 ]# R0 b$ x) G( { }
! k7 H" C* i5 Z) D" D2 j: ]- g if (document.sform1.email.value == "") # S$ w5 U* ^3 H! b8 o* e; R
{ ! ~- l- A0 Z0 W' _1 I/ @
alert("请输入您的E-MAIL地址"); 8 ], H" {4 M. o ^, ?) |
document.sform1.email.focus();
. Q7 Q" P" A' X! Y5 s9 M" Y. w9 Y return false; 0 S. r! w6 {1 t$ I/ {5 C4 \
} 3 v2 m& l3 O+ j
! \3 G; P' Q4 K1 [$ R& e7 U( C1 j
email=document.sform1.email.value;
0 n7 q& ]8 I) G6 v: h6 K! q# W emailerr=0 / v q9 V8 w7 [5 Z7 I! L
for (i=0; i<email.length; i++)
2 x% x F+ n4 C8 q6 Y o0 d { # S4 C, ]0 @6 o
if ((email.charAt(i) == "@") & (email.length > 5)) 4 L( c9 }! y$ a' Q
{ ) ~& [5 Q; F* V
emailerr=emailerr+1 ) d+ K6 M. h9 q4 C
} 4 O5 u% I/ o# |) X
} 7 X' a: l/ P& Q
if (emailerr != 1) - F; d i! L2 x1 i ]" |
{ " r* |4 `0 F. i* _% j
alert("请输入正确的E-MAIL地址");
6 _/ |; V6 _$ L( C document.sform1.email.focus();
4 q( r, v" [9 l) I) M return false; 5 u) Y5 t! j. q; w2 W. x3 l; n
} ! d1 ?# t* c! n
% h6 p z. |3 n, h3 w if (document.sform1.checkask.value=="")
" d3 G! ]* H! @- ^2 v3 ?. G! Z { 6 {6 l L3 I% k
alert("密码提示问题不能为空"); ; D/ `# W8 S: O' I" I# Q
document.sform1.checkask.focus();
h8 h5 L" P4 ?6 M' C+ X" e" V return false;
: i% U3 M) X1 k0 S5 K, k$ r2 W }
3 A; h4 e, P5 y if (document.sform1.checkans.value=="")
( f+ f" U! O) [$ M! n* s" k { 1 ^- V- c" p3 o2 G
alert("您的密码提示问题答案不能为空");
" H: J, z/ G/ w+ ~) d# J document.sform1.checkans.focus(); 0 q% q+ n* |8 W% l
return false; / V; n; z9 c; X
}
1 Z! G$ C; f' X& ?3 _) ~; X return true;
! l* d% O9 b, i8 u. w 8 p; u2 y2 B% g# N
}
D& F, a2 C+ z+ ]9 D</script> |
|