  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:: h) Q/ Q& i/ Y6 R3 j P
<script language="javascript">
6 R* G+ u/ o& V* E S3 W! Lfunction IsDigit(cCheck) + }' |8 ?, V; J
{ 6 U. P6 z8 O# I( a
return (('0'<=cCheck) && (cCheck<='9'));
2 ^, d/ {6 ?2 ?" L2 }* F) ? } & i) R7 z" I0 j+ D3 }
8 {9 X; I1 X" ffunction IsAlpha(cCheck) ( [1 l$ H( t8 x* N u
{ & [ w1 N0 g3 @4 c
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 ]& ^" v' V: b$ z6 s
} * V# Q! Y: U: n$ k
4 j$ W3 D" K- v4 N% G2 `5 ]
function IsaNull(cCheck)
n5 g9 D4 a' W& H: K5 f {
- z) b3 E. q. j% x+ }$ F3 l! T return(cCheck != " ")
: U+ L- P' @$ F }
5 R" y, j) U+ ~; X O 7 |9 c: G# [( Y/ [
function checkform()
; b4 Y( D/ q$ F* x- I h5 K{ 1 t- u5 s% M2 g# O/ A \
id = document.sform1.id.value; ! Y$ i& l5 M" C+ q) Q6 Z, e# A+ |
if (id == "") % ?" [, A8 @# l8 v
{
, Z) K! G6 `9 Z alert("请输入注册名"); 2 M V4 f- P7 M! B" {! C- r; p, [9 V
document.sform1.id.focus(); ' e u7 c$ }, S0 U0 m+ j7 }3 D
return false; ) w* M5 M& h0 r: x" u6 x
} # J! ]% Q0 Y" P
' s- A9 g! w& D! j$ | for (nIndex=0; nIndex<id.length; nIndex++) + A( v: j0 V7 n5 V8 H6 Y
{ , G* T" b- O0 m5 x+ W/ q/ o
cCheck = id.charAt(nIndex);
* `$ K& a6 f7 k* @/ H, O6 { if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
6 e% c* u& ]0 B+ x5 m {
* E- a% t# Q9 \ C5 m Z alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
5 `- |/ P8 G1 k/ D& w! o5 | document.sform1.id.focus();
) @# Y6 \& c' V0 d, h1 V return false; , {3 K4 K& E+ d7 h' j9 x- o0 a
}
: `; X% o& r7 W0 p. w; ^ } 7 l2 I: s7 y" e& G2 c" a$ s
chineseid = document.sform1.chineseid.value;
& P% y3 f5 k4 r1 p* m Q* t3 m: z if (chineseid == "") z7 A# R2 V5 l. p+ Y- \0 ?) [
{ 6 `- B* }( X7 Q8 x: A
alert("请输入中文昵称");
+ b, {7 ?: h. q- S7 z document.sform1.chineseid.focus(); ! o: K2 E' b+ W* k1 y/ G
return false;
: }8 ]3 ^, {- p" I4 T4 T( i4 q } 9 x% g2 |0 h* Q: {, t- D
password = document.sform1.password.value; ( O/ m2 v8 g3 y- F+ b
if (password == "") ; K. Z C. B- T5 O4 |
{ " Z! i: |+ a' r2 w5 O
alert("请输入登陆密码"); 5 X) p' N6 e; w. g1 ]3 V3 J
document.sform1.password.focus();
- _/ j. _$ N* Q: U return false; $ d3 y/ y0 ?' x* m
}
9 \0 J% H4 \( O password1 = document.sform1.password1.value; . c" \9 i4 y6 h) T/ Y4 R' Z
if (password>password1) " |$ p& \5 N d& H( ]6 k
{, e: o. N: B' ~" h1 F
alert("重复密码与登陆密码不相同"); 5 b( W$ v" M9 y9 a2 x# D
document.sform1.password.focus();
2 [6 o2 p, }+ k- d5 \ Q document.sform1.password1.focus();
% Q0 }5 s! }$ p. ^$ `1 N return false;% o/ |. q4 w$ G* m! D3 Y% S
} 3 \6 p2 S4 f1 a7 c* e
if (password<password1) ' E4 B" G) ]' o$ Z
{8 c* L3 Z5 K, o" U) s
alert("重复密码与登陆密码不相同"); 2 M2 q B U8 v4 I, z
document.sform1.password.focus();
$ b" _- Y5 f* V5 N6 A% X document.sform1.password1.focus();
: u- H3 N% q: A! S \' I' ] return false;
0 m! M8 h9 C: p) ?) j d! ` }
3 T( v8 u) H- s if (document.sform1.email.value == "") 7 W- X; x! ^* ~: \& x1 S: r
{ ( y$ e5 T# h" z0 F% e( A8 S
alert("请输入您的E-MAIL地址");
9 ^4 ~8 a' y' m9 e2 V document.sform1.email.focus(); ( W6 Q' Z- `7 P
return false; $ q! Q2 ]% ?! k# w7 ]! Y) ^
} * ^, @: d: j# L9 Q2 `& f. y* N
" A/ R( q$ r6 U6 j
email=document.sform1.email.value;
/ r8 @2 N1 |; t$ }- @ emailerr=0 3 Q# _- R C) u/ P
for (i=0; i<email.length; i++) 1 i8 f5 `* N6 i7 N3 a
{ 0 T$ ^; B+ s- O6 A" I+ r# R
if ((email.charAt(i) == "@") & (email.length > 5)) 9 m. `, ~( s7 C, ~
{
% n: l) f+ d* l4 i/ @ emailerr=emailerr+1
$ ]6 W5 _; X. _0 c; D6 L5 i D }
) z+ ]/ A& m' k } $ _- M" K2 T* U. T8 a
if (emailerr != 1)
9 I/ e' {5 O p5 \ D6 g M {
+ D7 |$ { D+ h) m alert("请输入正确的E-MAIL地址"); ( \/ ~# [( _, \& h: e
document.sform1.email.focus();
& j1 \- }( K# n- @1 v) { return false; 5 P }# o$ e# L1 O- a* g4 Q2 S5 _) O
}
1 F( J# u! k+ o% p, w % Q y% \2 P( P% v3 ^# S
if (document.sform1.checkask.value=="")
6 ^6 o, X1 z7 s { ' j9 a2 S; `9 E8 i0 L6 o% U% B
alert("密码提示问题不能为空");
( |% `8 t# ~. o, y( R document.sform1.checkask.focus();
6 f/ S" P; G1 @' T! Q! r return false;
7 a4 i- |% Q7 ~; ^, d3 B6 G }
0 V- s/ D# G0 v3 b/ p if (document.sform1.checkans.value=="") % `8 u6 R+ m' s
{
- |9 F7 {" C+ s6 c \: x1 L7 I alert("您的密码提示问题答案不能为空"); 8 p9 W3 ^/ n5 B1 ]4 c
document.sform1.checkans.focus();
2 s# f( R% g; t( T( A3 K" v4 p2 \& N return false; 3 ]3 w+ G% a5 `8 I' K
}1 w( \. Z) l- [' B* I, i! ^- t8 t
return true; % Q- ~ \5 _% M& d' e7 J
0 n$ @9 t& i) e) O* ^4 n2 i}
% y3 r+ N% T5 Z6 ?</script> |
|