|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:" t2 }6 U: a& ~6 S
<script language="javascript">
7 p. w: ~' r( ]' a H! f# Pfunction IsDigit(cCheck)
9 N8 U, u) a s, F5 c2 R" G- n! H P { 6 V2 x+ F f0 p5 V
return (('0'<=cCheck) && (cCheck<='9'));
4 T0 {5 q8 h( Z6 d3 C } 9 F( V, p# j: Z2 X: d
# t5 i- j8 R& @6 Z; {
function IsAlpha(cCheck)
6 t+ t- F. ^+ ]+ E0 u/ [ {
, r/ C4 k8 n0 B3 T return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 ~! l5 M0 x# O9 w7 ?+ |
} 2 s9 q5 R* J: M0 b6 E- k
# w: _: f* l+ t9 v) cfunction IsaNull(cCheck) 7 c' A8 k" c! Q( \* S6 \- Q7 a
{ $ \2 ~8 v" |) d3 _
return(cCheck != " ")
; x( m6 h! `7 W: ?, _4 ` } 1 d1 H. i* {* x5 A
# h$ W, Q3 R2 ~' y H `. C4 Gfunction checkform()
3 a$ j( \: r' s+ C{
* a% I, {% d d8 F& C1 Z* o* w' w; {* t id = document.sform1.id.value; $ o+ [- v, m" g; W
if (id == "")
/ X* g- h' M8 A7 ?6 a: j {
8 n0 U" p$ K5 A& C2 D6 |8 j& | alert("请输入注册名");
. n; W% z$ m* G$ `8 K. C% i document.sform1.id.focus(); 6 {7 _3 X, B5 C1 `2 h8 A. u1 B
return false;
, \3 w7 K7 W+ [! U W. c9 A }
1 ?5 S7 C. B$ D, A! {# s ' r& b$ N+ T$ t
for (nIndex=0; nIndex<id.length; nIndex++)
$ T+ j2 g( m' @' b3 k- h {
* K0 Y- J& r a( G cCheck = id.charAt(nIndex); 3 l7 V) F# R- K+ h, g0 G
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
, }8 p1 ~$ ?1 n3 K4 e5 h {
- L- O0 d, ]- ?2 n alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
1 R* y& p0 f/ a) } document.sform1.id.focus(); 8 D2 n. E1 Q5 X0 A" l- m
return false;
$ V1 E2 R8 J! l" x1 s0 c } / ^6 Q6 D S+ H2 H$ b% b
} # B# {6 r! }, i- z# S7 s
chineseid = document.sform1.chineseid.value;
: T6 q9 j- C- r4 [9 e/ y if (chineseid == "")
* M8 H1 h5 j2 ?. z2 k* U {
' g( H& p3 ~: t) u* _2 Q alert("请输入中文昵称");
$ Q, ]! z0 i1 ~" m( A document.sform1.chineseid.focus(); % H' l) S! x% t ~1 D, I
return false;
3 A# O$ O+ f6 |' J) o9 a! W8 q }
. w. ^5 Q1 @) d8 P1 K password = document.sform1.password.value;
& D( M$ \( j0 f6 M2 x if (password == "") 1 G% R) d1 A& h4 q6 i
{ $ r# U% ^& ^4 M
alert("请输入登陆密码");
6 x. q! ~* \9 n% Y& {3 W5 c document.sform1.password.focus();
9 J5 w B, z7 T3 b5 ^( ] return false;
: r+ l: H% e* f! F } * E: M2 k( K8 B) r7 w
password1 = document.sform1.password1.value;
4 ?! ?* U1 j0 o# L L1 j if (password>password1)
) c2 b' D# ~6 }5 E {
6 O+ r9 ?! G# ]$ v& K6 U, } alert("重复密码与登陆密码不相同");
6 m. A! k' f. z: t4 z/ Z document.sform1.password.focus(); & W4 ]' U) h6 b
document.sform1.password1.focus(); * L' e1 C7 L5 ?7 y+ T
return false;
6 i! @3 L) s7 f0 } } # ]9 K o \3 ~# r; b* T
if (password<password1)
$ W B, L* e' I3 k& U* i {
1 B# n4 X- N4 c' C* G( h3 R. w3 O alert("重复密码与登陆密码不相同"); 4 ~9 _$ K6 c/ {4 _' @1 n
document.sform1.password.focus(); ; ~) r1 _7 T1 p+ P" o) z5 h- J( f
document.sform1.password1.focus(); 5 f# [6 G# [# `, R) |" w4 x D! l+ [
return false;
" B; u" [: ]3 T5 X& m }
! _1 N) z; W2 N ^ p if (document.sform1.email.value == "") - N0 X2 X H: [: Q/ j. l) X* F
{ " z% r R! G! H9 T
alert("请输入您的E-MAIL地址");
& ~' V; s; o$ t0 m+ z9 [0 f document.sform1.email.focus(); * ~' y0 j5 }2 m) f
return false;
% C |$ L3 M& I5 q5 k1 t6 Z% L }
" T% G! ]7 T, S1 q7 t2 H- |! q 2 H, W) A8 ~7 Z8 @: J3 d4 H
email=document.sform1.email.value; * J2 P" _* \) ~# u `1 n' L. j
emailerr=0 0 _+ j; @" Z& ?0 ^2 X, t) m% j" O' \
for (i=0; i<email.length; i++)
& Q9 q2 S5 Y8 c% D; o, n% w { + ^4 M+ j8 W6 M9 {# O
if ((email.charAt(i) == "@") & (email.length > 5))
' R9 \5 ^5 v8 @' _! }% |, ^7 n {
( E) r' [& c; n" f$ q emailerr=emailerr+1
/ y) i+ I( I, s0 w+ x V }
9 M3 w4 g$ p. g5 u( P2 m3 |1 h4 b }
K- ?" R, N# E; _6 z: p if (emailerr != 1)
& }2 l S& J/ I" e" c, j5 J+ z U" X {
! ^! m* h8 `' r# s# ~ alert("请输入正确的E-MAIL地址"); 2 P, S0 p8 d) Q5 l+ Q0 A
document.sform1.email.focus(); # Y( e2 `5 _: i0 O' S; J& C
return false; ( d6 T' U- i: R" u) C, v1 n
}
# B1 D: |8 I S5 p% }4 | 0 O) ?0 r; Q* L$ t2 S
if (document.sform1.checkask.value=="") 1 c/ M/ Y6 o# t e& V$ B4 N
{ * Y [$ F6 t: ~5 l* ?# b/ g
alert("密码提示问题不能为空"); , e0 c4 s: f* |- }
document.sform1.checkask.focus();
7 k9 X. @7 ]0 y1 b, s% X8 b return false;
7 B, v4 w6 R& U9 _7 q6 D6 J1 `" o' n }
: m- |7 h) w6 _' z if (document.sform1.checkans.value=="") 4 n3 t4 p$ P; ~$ T* P9 z, ^) O
{
. C& \/ p/ |2 H+ h7 F1 e alert("您的密码提示问题答案不能为空"); + ?( q8 W. w8 Y+ U( j$ `2 m
document.sform1.checkans.focus();
' f, h' x+ y! _6 v4 ?) M+ v" ` return false;
0 W$ W- T7 _1 l% ]' |. K3 H }$ y# |# N# L' v& o# k! T
return true; 5 e/ g2 [9 w4 ^$ L3 _5 I: i
; ]: z7 [! G& \$ C8 M! }# ^
} ; n9 H! m9 g1 I4 l3 N
</script> |
|