|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:8 R& E7 b% v/ I; A9 i2 y
<script language="javascript">
- @, W, P) D3 p" c6 lfunction IsDigit(cCheck) / |. d) _% \& F: ^0 h) h
{ 7 f m# U3 g) W
return (('0'<=cCheck) && (cCheck<='9')); ' N" A1 j# U% ~5 D, o) t
}
( m/ H7 F- f$ m9 p . L K) E3 d. s6 `1 r) ~
function IsAlpha(cCheck) 0 _- m4 Q8 j1 A! ]- D7 ?' c
{
) _' N0 }, H- F, T return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 3 F! l5 @# P5 f S
}
7 ~* [8 S) V* x/ T7 F* t " {# B% U {+ r
function IsaNull(cCheck) * v- ^7 e8 B1 v! p& i3 d4 W w
{
6 y. @ P2 y/ H- l2 Z* C& _ e return(cCheck != " ")
' V2 f/ c+ i4 J: U# H } 3 ^7 p; R0 ~4 p2 C6 q |7 \1 \5 p- h
7 j3 x# g; v& a) \* ^, b# }1 `" W# hfunction checkform()
* n% ?7 o; u& P) w{ / S$ ]1 E- r* F8 n* H' x
id = document.sform1.id.value; 8 I% P4 G x$ i5 a" t
if (id == "") 9 ^& `, Q2 c& S/ ?9 { [" P0 K
{ 8 Q! @- {: W9 \$ r- V1 `! @ X8 O
alert("请输入注册名");
+ J6 q( I5 R) U" m! C document.sform1.id.focus(); 3 Y. n9 C8 b( e/ Q# w* t/ B0 |
return false;
* D1 v* H& w) I! u `6 q$ B } # t% @( v7 Y' d$ ~3 W! g6 o
- Q6 i+ Y7 q& r
for (nIndex=0; nIndex<id.length; nIndex++) 9 `4 |, c" ~+ n5 E% M! b
{
! G" l5 K a! p cCheck = id.charAt(nIndex);
}) m8 i. M+ S( ? if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
& P2 ]3 ]4 m6 F {
- u, j: h# S$ I alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); " i/ @9 M$ x, I. _6 K# U
document.sform1.id.focus(); . V3 m9 {0 T- v
return false;
/ ]8 S# e6 K$ D- N } ; G5 ?6 u: S+ c, n% C" M, Q0 b
}
1 s( S7 f' {6 N2 `; m0 V chineseid = document.sform1.chineseid.value;
* }8 p6 H- r4 \- { if (chineseid == "")
: ^; i A+ J8 P4 j, F, G) z { 8 g1 s, L" u3 ?7 B
alert("请输入中文昵称"); 7 Y& P: q) @- T; |! e0 j
document.sform1.chineseid.focus();
+ k% u7 o2 |2 k. ~5 h# P return false; X# X: p$ I% v* j& l
} ) h5 j8 A6 m2 @4 R; U4 e
password = document.sform1.password.value;
K. ~) K3 v" N. w4 B9 c- g if (password == "")
$ I& R: I+ H- Q( ] { , [5 I5 T. R" C4 q4 G
alert("请输入登陆密码");
; W- r. k2 r6 X! t document.sform1.password.focus();
7 |, h! B/ Z; K( H" k return false; 2 N9 y, e( ?/ ~" _2 x
} ( Q1 V8 o& d( r5 d
password1 = document.sform1.password1.value; . W2 \ U' J- n
if (password>password1) 4 v: Q0 m; X# u s" i
{
- p0 q; X. V1 V6 F. E! v' L alert("重复密码与登陆密码不相同"); + u7 y- K% W7 ?4 L# }3 K, u
document.sform1.password.focus(); 3 U, P" i5 ^: Y+ Y8 Y6 @
document.sform1.password1.focus(); 7 e5 l0 A" p1 o8 v
return false;$ i1 G# u2 Y3 E4 R
}
9 J! b! v* I* U8 c- V' m0 Sif (password<password1)
3 E8 d( \) r5 h6 L2 @& O- t {
( M m8 `4 o0 i) I alert("重复密码与登陆密码不相同");
, L! m; M N: Y* ~ document.sform1.password.focus();
2 L4 |; O# V7 Y9 o document.sform1.password1.focus();
, q# }( ^$ D. w7 p/ H return false;0 @' z- a# G* ?+ \
} ) b8 q# `$ |8 E2 e7 \( Y6 J+ J4 E8 b
if (document.sform1.email.value == "")
w; _, p; f* B* K2 |- r* K8 F {
4 n' Z1 C# w: m& \# H3 V alert("请输入您的E-MAIL地址"); ! B! r1 E. I1 y$ @
document.sform1.email.focus(); ( M7 T7 o% _7 ]. w, q
return false; + F% }0 ^5 l; {* @8 a& r. B2 a
} ; W+ j! Z$ D1 O/ r* r, R/ j
4 |4 H& ]2 v7 b( o email=document.sform1.email.value; 6 q5 |# W6 z4 h; y* l1 {. U
emailerr=0
& d! Q* \! x7 ^9 |9 J for (i=0; i<email.length; i++)
* C" S- T6 I; y { 4 u" `) B% N& A& q
if ((email.charAt(i) == "@") & (email.length > 5)) ) S. N% g4 e( o
{ / H, Z0 Z0 E- f9 V
emailerr=emailerr+1
* d7 t5 v q! K2 S } , m3 j/ ], w7 f
}
; b* s, n6 o! @ if (emailerr != 1) ! z/ A, b0 u; d6 v' f1 q% j
{
- n9 q2 e( I* T9 B: C& q0 e alert("请输入正确的E-MAIL地址");
8 ^4 E% v6 G' S7 u document.sform1.email.focus();
S# {" E% y/ j% U) z7 } return false; 3 s, q, [7 l7 P+ ^. @8 i
}
% J' y1 n8 v$ e
. @' B2 G. \% @1 p+ k/ P# k, v if (document.sform1.checkask.value=="")
# s7 g# ~2 @1 M {
1 W. a; X! _# H3 g. L alert("密码提示问题不能为空"); ! F/ J* h( ?1 b2 \
document.sform1.checkask.focus();
$ b9 N/ V# r. K+ Z" [. X/ V return false;
) S2 W% t0 L, s6 @8 g3 @ }
/ S5 X3 H: v, {4 y% W if (document.sform1.checkans.value=="") 2 B) ?0 h- P% X& X6 O
{
7 P% J) V0 }8 V/ r" } alert("您的密码提示问题答案不能为空");
1 H4 S: e" z. T document.sform1.checkans.focus(); # i( o; y& _ i
return false;
' C ]# A* |) ~ }$ o1 G+ _. s. D' L T
return true; $ r& [. M& b1 E
! w- J; q, ]( Z/ W}
3 `7 ]2 M0 g( ~; e/ J6 D. W</script> |
|