|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14385
- 金币
- 2478
- 威望
- 1647
- 贡献
- 1426
|
这个脚本对你可能有帮助:: d; l) R S$ r' p
<script language="javascript"> 2 \" k! Z& w3 l+ f6 z' I
function IsDigit(cCheck) # q: f! I% I4 k: l, e
{
$ m4 j$ d8 D$ k, z; N* d return (('0'<=cCheck) && (cCheck<='9'));
/ v0 s" P$ X* p6 ]2 g }
! j# q5 h+ ~- h7 [ 8 b L9 e% T" A' ]
function IsAlpha(cCheck)
1 v; ^, o% G% N k9 @ {
! f7 l. u3 k/ K7 E1 u! Z return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ' o5 I% K# Q3 t! t4 {5 o. Z( T
} 2 C9 L2 c: }6 r% m& \: C8 q f
2 o: _* [9 d7 ofunction IsaNull(cCheck)
$ D: c# W& s% R. s6 ~ T2 d% o! k {
( Y0 v( w0 f; ]8 {/ J$ k return(cCheck != " ") 0 x" O! u! g" ^* O& l
}
) E1 T7 v* g+ T0 r! P: | # c2 Q; l- m! }4 D: o
function checkform()
/ b) P) ^$ }* ~7 u8 v. c9 f; t5 c{ & j6 R) e# n h- P0 `% I: M
id = document.sform1.id.value;
4 \" h2 |! I. D( S8 Q if (id == "") & q5 @# C; v" N: c. t
{ & `' {4 O) V0 @5 o) c4 c8 J
alert("请输入注册名"); ' U6 G9 l) r$ m7 V b: B
document.sform1.id.focus();
% k0 e4 X1 F% E* P+ L$ H return false; # i$ A, O" u7 X" ~6 A
}
$ S {6 G9 d; u7 `& E1 k( Z: I " Y* U& t8 V0 k- Z6 P* S, t
for (nIndex=0; nIndex<id.length; nIndex++)
& o* @: D$ D: b: s2 W) j+ ?5 Y {
) w) l& d, g5 g7 L cCheck = id.charAt(nIndex); P3 Y, d) S1 O4 I, v8 o2 L; u
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) $ p7 z% E" f- n% t
{
+ n; ?; [; a4 _; _* ?& q alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * x E9 s" F' q. Z) ?
document.sform1.id.focus(); ! o9 A. {: A6 ^3 e
return false;
5 j$ e$ [6 p, m3 p5 r, M) T9 A }
" C; S. T8 I5 L0 u3 g* r. T }
. A _+ e! V" ~! T9 X1 M O chineseid = document.sform1.chineseid.value; ) a0 |4 t1 r5 N# X7 L' ]& [" g
if (chineseid == "")
, o& c( O* \6 Y3 _3 m5 _$ _ {
! n5 I( g- M/ U, _* ] alert("请输入中文昵称");
% U6 [7 G, E6 i9 t! C5 E) l0 }( z document.sform1.chineseid.focus(); 8 _: _, T. @+ Y( ~7 _
return false;
2 i9 C0 ?- N& ~4 A( `- x }
' ]+ Z+ E/ i; o5 Z, w% f$ b password = document.sform1.password.value; # Z2 U1 ?$ S0 G2 l
if (password == "") + z# F4 E0 L5 o# C# h
{
& Z( `5 o7 Z4 ~0 A alert("请输入登陆密码"); 2 L2 | L7 l/ E: {% u6 I$ N
document.sform1.password.focus();
9 e5 k. U; D& C) j- \3 T return false; % u+ D) o7 v! X$ z& D, l
}
* r5 t" q, q: @7 `- Z. y" l6 \4 @. z password1 = document.sform1.password1.value;
3 M: C% S8 i' V8 F% C$ G4 }# i if (password>password1) 2 b4 u2 M( M, G% G8 ~
{
1 ~6 B4 k4 U5 k6 {, P alert("重复密码与登陆密码不相同");
* ^4 y4 z& O( ^1 h7 P document.sform1.password.focus();
# _7 |4 B8 P/ I5 _) Z document.sform1.password1.focus(); ! h4 c; E0 |8 D) _1 H0 @0 Z4 c
return false;# _5 j& n+ @' o, Y" B. N
}
! P+ Q; A# d9 {: J$ W; [if (password<password1) " a* @( {* R# m' I h( v
{) x, T4 w: F, a6 f* P$ {1 s
alert("重复密码与登陆密码不相同"); 7 l/ `7 L) t X+ E7 c2 Q5 k0 N9 Y
document.sform1.password.focus(); , d" T9 z0 O6 v4 ~8 c7 N6 [
document.sform1.password1.focus(); " ?7 N L7 A9 G0 ?$ O
return false;3 z- P5 a6 a( D) C
}
: P9 H1 v1 R3 d if (document.sform1.email.value == "")
0 `3 F' u9 w' b8 Q0 {' s: [7 G8 x {
9 q/ _- ?3 Y5 ^% [1 r/ a alert("请输入您的E-MAIL地址"); , d" X0 F2 j. U" r) z& m
document.sform1.email.focus(); ! o* Y2 d, `9 W9 j( `8 [
return false; " f4 c- C9 N; @2 k7 [/ n7 {7 K
} # d% o' L: u7 O8 Q5 S
x* s* r' C1 o- o2 r# a
email=document.sform1.email.value; % J) J% D2 m) c' x6 |
emailerr=0
. w4 [% k. Q- X% |6 A for (i=0; i<email.length; i++)
- O' Y+ ~8 Q" ^, g8 D+ P { 6 e7 R5 }5 |/ H, K
if ((email.charAt(i) == "@") & (email.length > 5))
; A1 i- J; }; i+ P- p8 M { 9 ]% p6 N* y- F( t# @& k
emailerr=emailerr+1 / o6 i, {" a# o$ x6 D; E
} 3 [: K' H' J0 Y7 i* D! s" C; S( o; K
}
5 b; {+ g q6 C5 K* k if (emailerr != 1)
: k" R4 t* T: [; L7 ~# L { / T* Q% d6 \ P4 C/ `# s
alert("请输入正确的E-MAIL地址");
, ]8 E. I; [2 Q* n8 s5 t document.sform1.email.focus(); ' D% a# O# ^9 i
return false;
% _4 |+ `, ?; A7 ~8 c/ r- S }
: W( u# y3 { b0 i
* q" Y0 G& A+ q+ r( K& H+ P+ R8 c( a# ^( ? if (document.sform1.checkask.value=="")
2 R8 P" g, H0 j8 T3 l2 _ { / ]- E! J' k1 W) D. `6 x, d
alert("密码提示问题不能为空"); # o6 D1 @6 i) z I& L
document.sform1.checkask.focus(); # h2 I3 q, l L+ p% i; O
return false; 1 p4 {; C: H+ I% L/ a4 g, y1 F
}
' I @3 V4 _6 s% H- Q: \% u if (document.sform1.checkans.value=="") * b- t% M: |9 L/ R6 Z6 Q* x
{ + Z# E% ^3 \, e4 F' l: q
alert("您的密码提示问题答案不能为空");
4 x# l2 W4 A; C; [: h& ~8 j& \ document.sform1.checkans.focus();
( W0 P3 v; D1 z7 A! Q6 g return false; ; G6 ?7 L8 q& Y: ^+ O
}6 H" v0 w$ }- v; B5 v
return true; 3 r; V5 e, S; s
8 y, W ]2 T3 ~. p% A}
! O; [ J3 @5 [( F+ k3 s7 l</script> |
|