|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14331
- 金币
- 2451
- 威望
- 1647
- 贡献
- 1399
|
这个脚本对你可能有帮助:. A$ G. o" N: ?4 M! U% D; f3 c
<script language="javascript">
! Z {" u* L( Y8 z2 H4 c" t* Yfunction IsDigit(cCheck)
! e X+ Y8 u e { . Z4 g* J" Q7 H! U# O
return (('0'<=cCheck) && (cCheck<='9'));
; w5 m7 x. Y1 e6 P( z) g I+ x } - K9 S% Y6 S% K' X# }
4 B3 O4 x' x/ V) Ofunction IsAlpha(cCheck)
; i% w- N, D$ c5 m: r- ^ {
/ I: y! f' E2 X: ^7 p$ s! S7 h. { return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 x; P! _( w* L' p1 G
}
}; t3 r0 z8 M. C
/ @3 q5 d0 M# C% Sfunction IsaNull(cCheck)
: J/ Y# W( Y9 k; \ @ {
* h4 m( ], p8 S) S) s' h- v return(cCheck != " ") 2 u4 M. P$ x5 I. c) R
}
6 L. F' E, r0 @8 h& J
8 v' Z2 s6 D' ~( Z5 Q$ b* {9 ~function checkform() 2 R1 h0 l( {/ m2 V0 S9 h
{ ( e7 C a2 s, t4 f% U7 i2 Z
id = document.sform1.id.value;
, a9 K" y. D9 D* ]2 F if (id == "") , \+ _& ]6 N; s+ }4 \
{ ( J- x) [0 g& Y. P5 b& F- X
alert("请输入注册名");
3 g6 H9 w8 Z, b. _1 H0 k0 {' ?& l document.sform1.id.focus();
5 d0 v$ F$ g }6 w return false;
# P, H, K& i Q& I! N }
8 h( m% y; [' ?3 Z- z; X+ u / B L: q: d. e# n
for (nIndex=0; nIndex<id.length; nIndex++) " i& ]' T" H: D5 A# Q
{
! |8 M+ v' U, J3 G7 d+ X0 L8 ] cCheck = id.charAt(nIndex);
1 \ k5 r, j+ z7 X if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) % X; l8 @: Y& i9 P S$ p
{
6 h4 K: w5 M; ]. @6 v( ? alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); / N9 J! b+ p$ _9 u; b. m5 r# @3 T
document.sform1.id.focus(); 5 K. ]* w( s, p
return false;
* Q3 n3 F$ }5 i# L9 w& H }
8 P, T# D! Y5 M# e( x ~; s3 F } & K& u3 t( A% B% T" s' V0 o+ J: y
chineseid = document.sform1.chineseid.value;
! Y, y' s/ [1 q7 \8 f if (chineseid == "") 2 W8 ~- U A6 o( A" c2 L* Z
{
5 j# i& m* S$ b0 \' j alert("请输入中文昵称");
5 ?: X$ L8 `( }3 g2 F: M2 k document.sform1.chineseid.focus();
+ A' p8 l. i" T3 @) a$ f8 m7 s return false;
6 q- j1 j( B! l. F o; L } 1 z" l7 k" L8 G0 O0 T
password = document.sform1.password.value; 7 V( Q' m# E" g: H- ^9 q3 Y
if (password == "")
3 E, j. }% X Y3 H+ ~ {
) l9 o3 ]6 x8 @7 ? alert("请输入登陆密码");
y" K* N e5 s& y; W document.sform1.password.focus(); " @% Y- O+ U8 h: n8 L
return false;
1 g4 b7 X% \: s. D0 c: P9 M }
! U( c( F! i) _% O' R- }2 q6 M+ W/ G password1 = document.sform1.password1.value;
. m* ]% \* n: J9 |; {0 s if (password>password1) ) [9 {0 t9 |9 M I% G( ~
{
( S/ c% u+ _3 @ alert("重复密码与登陆密码不相同");
# f3 i1 L- X: Z0 ?9 {. L document.sform1.password.focus();
" ~/ B5 N+ }, S& p! p document.sform1.password1.focus(); 1 v2 ]$ j1 } Y1 S
return false;6 C! _, A& F# x5 V) w+ E
}
- J0 M: W: A; \2 h; s: b& Pif (password<password1)
5 W; p: r, `( g3 W! i; {. C4 w& U {: [# i* B: O; Q$ Q# c. F% Y
alert("重复密码与登陆密码不相同"); # n* o" [& ]$ ]" R+ v6 C: b
document.sform1.password.focus(); 2 A$ z( o7 h9 B9 p. @7 _6 L& E
document.sform1.password1.focus(); ( G. W3 f1 u* C' c% b
return false; U8 f( I3 E. \" k1 L
}
2 D& F9 N! i( d0 I- T if (document.sform1.email.value == "")
. q+ ]3 L) ?8 |" k4 u, U ^0 H( m2 j {
* A& M U! }; y6 g6 I2 d alert("请输入您的E-MAIL地址"); $ @4 d2 _0 L( V+ f9 H3 W; g
document.sform1.email.focus();
- s4 @' d. L/ N$ h3 X( ?+ r& L return false;
1 ^- S# r; @" C @3 W& B/ d } 2 {; D8 p, o) Y/ ]6 P5 q
: T A2 ]' V* n email=document.sform1.email.value; ) U! d+ o4 V8 F& A5 k- _
emailerr=0
Z/ n$ H( z9 V+ D {7 b* f for (i=0; i<email.length; i++) " Q& [4 G V1 K2 r, a, S: R
{
+ F* f; d" H. y if ((email.charAt(i) == "@") & (email.length > 5))
# k5 x m; i2 j" x/ R1 U* a {
, i5 c3 V9 {/ r emailerr=emailerr+1
# p/ p' V# {- [6 h4 E* _ } 0 |9 ?) M1 o' b& o6 W# s& n
}
6 F0 {% G- c n7 B if (emailerr != 1) ; l$ j' R% n$ \* S
{
. S7 P) r+ c3 e# J alert("请输入正确的E-MAIL地址");
. V9 p: L; ` R document.sform1.email.focus(); 0 q: U" i. b5 k' T$ t0 w
return false; 0 U% l0 S5 K( A+ @' L4 [
}
+ r1 D. c& Z1 k; X2 l0 q
+ H; v' g- Z8 Q if (document.sform1.checkask.value=="") $ d' M" f5 J2 V2 e; M0 [# E, d( R
{
@3 T$ J0 H% [( i( z alert("密码提示问题不能为空"); n% O8 L, L* e( @
document.sform1.checkask.focus(); ) ~$ w" o4 X# d0 P3 V
return false; M! m: }5 d$ J% Q
} ; {: o% |" Y Z3 V2 S
if (document.sform1.checkans.value=="")
2 C8 R: g ]5 l { ' x3 c& R$ P! z
alert("您的密码提示问题答案不能为空"); 2 C* Z" {1 l% F/ W/ t2 `
document.sform1.checkans.focus(); v( x. S1 L3 j1 q" v# ^
return false;
1 `' t1 }& l- ?7 @6 b8 [1 E' b7 Q }
4 r: V6 O5 `4 r, Q2 H8 E3 {5 N return true; 6 R4 V! |. ^2 S2 I! y$ p0 ?
* p& t |6 B, A/ j5 I/ Z F
}
( M2 M; p: s8 f- x8 `</script> |
|