|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14429
- 金币
- 2500
- 威望
- 1647
- 贡献
- 1448
|
这个脚本对你可能有帮助:' d+ B) \+ Z7 w9 P
<script language="javascript"> & l- C: H5 f4 }2 c" G
function IsDigit(cCheck)
( Q8 _9 k& K2 M4 X {
2 t& i3 F b+ [6 B return (('0'<=cCheck) && (cCheck<='9')); 8 S* K' c- Z: j( q9 T4 y: g
}
1 l. S. j0 i6 Y! `: l) d* s& a# f 2 @6 D X Q( J: p4 h% a9 C
function IsAlpha(cCheck) $ V; s ?4 V! }- H$ v& Y
{ / w" b! V2 ?" d6 ]! N$ _5 }
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 ?3 \" @2 E( N5 a8 \8 R }
; v/ _- F& B* _" j
7 ^$ V6 M# s' @/ q: U& ^function IsaNull(cCheck) 6 { \' b. }- h4 L: M( F
{ - R! m( m! ^6 [# q& L" r
return(cCheck != " ") . P4 n/ i; w5 ^0 F* s' @# M" N
}
# G) R) V. L9 C4 N$ H7 s/ Z5 Q# O
* D, L% D$ W) V" H$ {* rfunction checkform()
$ k: D4 H5 I/ e8 q! N{ . P3 R1 X+ L& O, }+ y# C; ~
id = document.sform1.id.value; $ n- H, i3 @- [- R) x3 |
if (id == "") # s& P- E" }2 y Q6 k- m; E' M, B
{
+ v" V$ W8 N' |% i5 T! b alert("请输入注册名"); 2 C( t. X9 {5 n; d4 s
document.sform1.id.focus(); , f. K/ t/ Q/ [6 R. X. m3 ?
return false;
0 I' n. S, ?$ W( f1 J0 [ } 2 w7 C, C9 H& K" U! G" R
4 E# _ u' M8 e$ O6 r8 K% f
for (nIndex=0; nIndex<id.length; nIndex++) & D p9 v/ p* w3 r* i% O* v9 N
{
* }; L9 c* v3 ]5 S cCheck = id.charAt(nIndex);
4 ~7 k; i, s/ q if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ' a& R( N9 o+ B* V8 }5 R( i
{ ! l# e/ Z# L% m3 J: u g) ^- v3 F
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , @) N' ~7 p4 t, ?
document.sform1.id.focus(); 1 F& `4 z# m0 Z
return false; 1 H2 w+ X: {' L" g
}
$ J6 _( l+ x- B& u3 `& _+ h } - h6 @9 S/ @4 Z. Z
chineseid = document.sform1.chineseid.value; 7 g2 q' G; g# U- X# g% }- h. B
if (chineseid == "") - L4 K2 Z5 [; G6 g$ c
{
0 j$ u3 D3 ~. G. C1 f3 {- q+ E( k x alert("请输入中文昵称");
5 ^/ U/ o) f3 b& B) | document.sform1.chineseid.focus(); ' U# q1 i1 z' s) y9 Y# O0 ~! f
return false; , o6 g: J/ [0 B9 X- [
} 8 l7 g8 l& f8 A7 j5 K( ] x& v- X
password = document.sform1.password.value;
2 G6 C" m4 A+ \! I& _' H if (password == "") & f% o" x" w& E0 I
{
' Q0 D2 b9 @" K8 Y/ [0 U alert("请输入登陆密码");
. z! O4 K0 w7 P' D( A" B document.sform1.password.focus(); - p. R+ |+ i5 |; h) z
return false;
' }- e( C$ t# a. G5 @2 J s } " q) O; g. m, Z7 s
password1 = document.sform1.password1.value;
: D$ g. c) L' `, {4 h& { if (password>password1)
" H& c$ `* X, I/ W- N2 S9 e {
! L. ^# |0 @/ d- n alert("重复密码与登陆密码不相同");
! u2 C" D% v& J$ Q! b0 F document.sform1.password.focus(); 5 B" f. z" t5 H8 \! H* o
document.sform1.password1.focus();
X+ N, d8 u# p; E return false;
$ q4 r( J0 Q# M9 s, M6 V; ` } 8 y8 J6 A# h' h3 D7 a5 ^
if (password<password1)
# i, |- y9 U8 C: E2 ] {" ?- P: ]" O/ W/ k5 C& I: E6 z
alert("重复密码与登陆密码不相同");
( C- i7 y. m! Y N* y; f document.sform1.password.focus();
9 k5 w a/ e+ O" v: G# f6 c document.sform1.password1.focus();
6 P0 S% ^' X6 B5 F0 Y7 E3 I, o% ? return false;
. E ?+ ^: \* f' ?% l }
# S! c/ Q. y+ j1 T/ \# u if (document.sform1.email.value == "")
" L8 a% n7 {; }8 ^) A9 r {
4 A$ ]/ x. I; X8 h; U alert("请输入您的E-MAIL地址");
) Z, a k% s( k9 C document.sform1.email.focus(); ! S8 K) r0 H9 V0 I! A8 P7 Y
return false; 7 R1 }1 q" _% l) g2 O. ^8 {
}
- P& u% m5 m) ^% T& M7 |0 a3 k ( ^3 K4 I. ?* e# p$ ~: x6 p
email=document.sform1.email.value; 9 u# K5 Y0 V: O0 z- i: [3 f
emailerr=0 % W. X+ E$ A$ C p
for (i=0; i<email.length; i++) 5 L" C& F' |9 x% H
{ # x* g& \! r: z) _ B
if ((email.charAt(i) == "@") & (email.length > 5)) * S p; _5 _0 i6 }& V5 G( N) L
{
, M, D, E9 ]% _. ^9 _% j emailerr=emailerr+1
$ e! s. y6 l, l* ^/ Z9 g) S1 T+ m } $ c u5 G# F+ U# l5 u e
}
& k& O1 t3 d' a) ^- \1 ?: N if (emailerr != 1) 4 Q& S/ O) d9 b' Z8 a ?: w; `
{
. S+ @7 _4 c& x- q: g$ u* F$ d alert("请输入正确的E-MAIL地址"); 5 z7 ~) y: r8 A& `, G
document.sform1.email.focus();
+ |: n' p4 b( B, Q: ?# E/ a3 m2 k return false; , d# d) W+ t5 C: s
}
: z2 v7 W+ G* B4 \# c0 n* s0 L
& Z* i0 _" ] z7 ?1 |* j& g% [ if (document.sform1.checkask.value=="")
" `' U) ^7 U7 M0 d1 a% F2 T { . h5 H/ \6 a0 A, ]
alert("密码提示问题不能为空"); 8 h* z" T+ X0 h7 v+ {
document.sform1.checkask.focus(); 5 L! A5 @4 L% g1 e8 v* c6 X
return false;
! W# X8 u" @6 S* R }
6 p) v* {# C& A& A! o; g5 q if (document.sform1.checkans.value=="")
y( T; ~ i0 |8 |$ s5 @ {
* b" J3 f* q: H% ~ j' L8 | alert("您的密码提示问题答案不能为空"); / [# T) f7 \" P7 I
document.sform1.checkans.focus(); ( k9 x0 p4 ?1 I) X( [% F+ a
return false;
9 y- p( M4 v; s }5 k: F J8 Z$ k7 s: Z, Q
return true; * Z8 r! G1 m# m
l0 @- ~7 O5 }" f' {# m4 D8 D% G}
& O: w7 l5 n [0 Q$ Q</script> |
|