|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
3 b) U4 g( L" \( h' |<script language="javascript">
- o* n/ f9 y! O& @) _" ]function IsDigit(cCheck) + h- a% ?5 C) E2 }
{ , b1 U' {7 \/ [/ \, h4 s
return (('0'<=cCheck) && (cCheck<='9'));
' g8 a. A0 `5 | } 7 L4 G6 D/ h! _0 S
6 m' k3 f* D. M& w3 C7 ^function IsAlpha(cCheck)
1 h* O- y0 }; [$ j; \- A {
4 v$ m+ C h3 L- H- o/ i: H4 v7 F" s! \ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) Q9 _4 A2 n5 Z7 x4 t" K, X& F9 Z
} ) [, |' s: [8 K* e6 r# k
6 s0 j) X$ [0 S; D% c
function IsaNull(cCheck)
& ]# Y' t5 F9 D$ q7 ] {
* H% [8 C3 n' ~7 f+ i) a8 X return(cCheck != " ") . J3 R3 p+ V* \. p4 ]$ C
} 2 y9 g( K1 I# x E
% g# G. F) r+ E; c8 T& Z* |* ffunction checkform()
9 d$ P+ @% }+ X{ # t9 r2 B6 X3 C8 E/ b
id = document.sform1.id.value; / o# e$ C$ J, D" {& [9 U
if (id == "")
* y( `* f! g0 x+ W# e4 L {
- F3 v3 a$ f Q% k# N# l5 k alert("请输入注册名"); * ~6 R, |) G9 Z. O! w
document.sform1.id.focus(); 3 X) I- }$ Z1 }5 Q+ A# P- y- o9 v5 \
return false;
/ T, r: _5 M- | l3 j& }0 G }
7 Q/ T6 n& D9 y6 b" g+ h
5 b% y' Q4 H% a& S for (nIndex=0; nIndex<id.length; nIndex++)
; J- J1 F. a! [. j { . S. E* Q S( |% b
cCheck = id.charAt(nIndex); 8 j( i, ?0 b( v/ `
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
. D- J5 ?' }( G8 t3 K# ? {
5 ]' C9 F. R9 u& Q& D- ]/ y alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 0 i1 t4 Z# c3 P- j
document.sform1.id.focus(); 5 U, A! M9 `4 b
return false; ; `# N' H) H9 _6 U- K/ w* @
} 6 y8 }2 X9 S; U5 b4 d+ K0 Y
} ' ^/ n5 X8 y& e& z0 a
chineseid = document.sform1.chineseid.value; 7 C% f! ^) g) _6 n- {
if (chineseid == "")
( i! @3 P, m5 @0 z& M, [1 Z6 r8 g% _ { - X4 N9 i( `/ o$ A- B' x3 S
alert("请输入中文昵称");
6 V: M* v# I7 V document.sform1.chineseid.focus(); $ C, Y' l( T5 T. s; i5 y/ O
return false; " n: ]2 w! e! j2 _3 t/ M
} ' m( b% T- e7 u. @' Y7 s9 I
password = document.sform1.password.value; / R) R5 C! m, r! z3 Z0 }$ r* h
if (password == "")
$ F2 p; P* {; m { ; i7 \% e3 M8 N9 ]% z: q$ r: X$ R
alert("请输入登陆密码"); ; _4 ?1 i9 t$ v% C9 M
document.sform1.password.focus(); ; C* y q5 x2 l3 G
return false; 4 R r D# y6 u" j$ P8 C' n2 N' ?
}
# ^+ p6 E+ r) @6 P: b7 M* P! c password1 = document.sform1.password1.value;
4 N$ L" I( E+ b" {$ L if (password>password1)
) ~9 p J$ x3 R4 }( L- ` {
4 N5 V1 b+ I4 l alert("重复密码与登陆密码不相同"); 3 c8 B% w V2 d# x4 P4 M
document.sform1.password.focus(); ; F# F, ?6 l7 B& u& N$ Z
document.sform1.password1.focus(); ' k9 |$ E- T( q
return false; k4 n% A {$ g1 | E
}
2 p* Y: z. W- I1 W. l* ]! ^+ c0 \, x, bif (password<password1) / a! d4 I* R8 z# H. p
{8 C9 d. p1 N* f: K
alert("重复密码与登陆密码不相同"); " N& b8 O% d* s/ |/ r+ a
document.sform1.password.focus();
, [: _+ e \/ O document.sform1.password1.focus(); . t& _5 w0 `7 q$ n% D3 N7 [
return false;
' s H# ?% e+ e( Q0 }7 b; n; c } ! r- j) r9 |1 N2 O1 V* z
if (document.sform1.email.value == "")
6 `& f& F9 x0 I+ k! E4 H$ Q { . }0 [8 O0 u S. E V
alert("请输入您的E-MAIL地址");
( ~( T% ^9 @) p document.sform1.email.focus(); ; J* L ^) e3 m8 m3 T
return false; * ~+ `) y- s) K" i) j! T+ s
} , Z r3 E0 `! ]8 z, D! s4 J
% v6 x/ v' I3 m
email=document.sform1.email.value; : z7 b1 H" @$ X2 z. z6 B: C7 |9 m% Z7 q
emailerr=0 9 k3 D" Y& f5 ^* V
for (i=0; i<email.length; i++) & o+ N n: W- C& ?) k+ n
{
7 D5 v. E. k* f! A if ((email.charAt(i) == "@") & (email.length > 5)) ! e& o. Q+ b l, Y! g- ?0 |
{
: N2 T# \- a) w( p/ q5 D7 W4 V emailerr=emailerr+1 9 c2 C n$ D% Y, X( C
} : V5 y6 I4 }4 p+ n7 z
}
4 {% v- m7 ]' l8 q if (emailerr != 1) 7 k( u5 M. Q" H+ J& H
{
+ P4 M8 U5 i: D3 v( U# k/ J+ y$ \# v alert("请输入正确的E-MAIL地址");
9 y7 |) j7 q9 ]: d document.sform1.email.focus();
: U8 T" m5 ]$ S# G" {8 g% s return false; / o0 Y* b1 n8 g4 P
}
, Y1 t0 e: D6 i a4 j
9 {) Z5 Y4 D1 a1 q) t if (document.sform1.checkask.value=="")
( _' e2 [! B3 M1 g9 ] {
+ I! S# ?2 w. G; Q7 q alert("密码提示问题不能为空");
( Z5 `. c& r# X- f; C document.sform1.checkask.focus();
; \4 B$ f. u$ Z( Z1 m return false; / T: p3 R9 j. E3 [
} , t% L5 L, U* Z' l% A
if (document.sform1.checkans.value=="") i" c# s( \5 V- N0 I) M( a
{
* u/ [% Y8 P% L alert("您的密码提示问题答案不能为空");
- J- x' f6 l& ~6 ]! ?, O document.sform1.checkans.focus(); ' L( P% m& c* D. L, N6 f
return false;
7 \; L% S. v. C' y }0 O% U, ]4 P/ y4 L
return true;
8 d$ I! r3 R" q8 J
! l& K% F$ H. x& p3 C$ G) [" \} ; ~5 N# a' K* G8 r* a- ~) w
</script> |
|