|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14339
- 金币
- 2455
- 威望
- 1647
- 贡献
- 1403
|
这个脚本对你可能有帮助:
0 r7 [. F+ S! y3 v8 F<script language="javascript"> # _7 b9 H; S7 J, h1 ~; s9 N# ~5 W F
function IsDigit(cCheck)
& r4 l. P$ H# X6 i$ A1 Z { ( N" J% _* A: \# S f; K% H4 s7 `1 _
return (('0'<=cCheck) && (cCheck<='9'));
: G0 S+ w2 k% Y) {1 u: g P7 [ } 8 [0 x* g' o" X0 K. V
9 U2 u3 j1 ~4 zfunction IsAlpha(cCheck)
$ Z/ |( y5 a% j# ?; z" {6 m9 _ {
6 x) {: s. X5 E! c. n, P3 | return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) # F" b( m# S+ d' `
} . X& l2 ?! u2 z% h& t
; X, D& M( b0 n/ Gfunction IsaNull(cCheck)
; P6 \ w0 w6 {5 a9 f& O! q; m { : W& a C& [, C, V8 B
return(cCheck != " ") : }8 y5 Y4 o4 s& s3 l! l
}
6 C" o7 J* R) x8 F" G) S; l 1 U0 a( R, i& j4 j' b6 ^
function checkform()
& \" [: _3 n+ x' j) v b{
$ Z [+ o3 X0 X: ]! F3 r id = document.sform1.id.value;
1 L# S& p3 w# ~( h( h if (id == "")
& [" {& s6 u1 r7 ?# @ {
4 l( X* c( g0 s8 V alert("请输入注册名"); ' N4 p- }$ d2 D- R7 u
document.sform1.id.focus();
, @! j% }8 E+ Y" @" P return false;
i. G# P6 p! z+ v6 f3 S }
8 _: f z% l' ^- ?! G4 u) u8 }& M
: f0 j1 t9 s9 } for (nIndex=0; nIndex<id.length; nIndex++) 6 u3 o+ C3 C9 \: ~8 i* Y/ H5 L
{
, v' t5 e. Q1 t2 u cCheck = id.charAt(nIndex);
) P0 U6 T1 P3 A' m if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% l, X8 z" t( M' i) d8 a) [ { 1 `% V, w6 ?) G7 r$ }' U( r
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
( S! k! E+ D% u3 W; x! ^( @" {3 Y1 | document.sform1.id.focus();
3 W( S2 P5 N7 k: \! A return false;
4 v. h/ p; Q: {1 K* B. r7 c }
8 L- F( u+ P6 s- M$ M! ` }
4 R3 y; }6 {# B, s) M# Y- C3 d chineseid = document.sform1.chineseid.value;
! B) Z% d- C1 l6 U' z if (chineseid == "") ( f/ ]: d: w! F# d% e$ ]
{
! Q' P8 t' c% t, `. W; g# O, l9 v% @ alert("请输入中文昵称");
+ a. [& G. ]1 Y+ i6 r document.sform1.chineseid.focus();
+ p' p$ g/ u4 T- _' a return false; & w; A6 O% g; c' u% A7 ^# M
}
2 ~' z3 }0 P, x! G1 q password = document.sform1.password.value;
7 c2 e+ G/ j' Q& P4 e0 B9 G L) h if (password == "") 5 I4 s" A2 k. i
{
* P" G+ V7 T1 J7 Y y9 s alert("请输入登陆密码"); & h& ]+ r& t; g8 B
document.sform1.password.focus(); 3 h9 `4 i" H4 T( _) t9 y' M0 G, f
return false; $ Q# [- \6 P4 P |
} 7 O* H. }9 ^' f/ j5 r
password1 = document.sform1.password1.value; 5 e, F' h+ [0 U3 t( T! b- N! ?
if (password>password1) - }5 E$ Z* i; S' ]) Q$ K9 r8 P/ Q
{9 [8 E- E/ @; j. { q6 Z9 O
alert("重复密码与登陆密码不相同");
* {7 M: s0 v( M& q$ m document.sform1.password.focus(); % v, Q- }9 }1 ^, C0 v. q
document.sform1.password1.focus(); 9 w9 x$ [* u' i( C6 `
return false;
) F" P- M6 l8 L } ! c+ X/ X8 H. I2 @
if (password<password1) 5 |/ u4 Y$ g5 p: [- Y$ ~
{
. Y4 ~& L, R* ]! @ alert("重复密码与登陆密码不相同"); % m" d* L; L/ r$ @: ]4 }' b
document.sform1.password.focus(); : I4 K0 c, _% Q
document.sform1.password1.focus();
; E7 b5 I5 F* }) E1 @0 \, a return false;
4 Z8 _- |1 d( O9 X' ? }
! }5 ~- [/ a' A# z if (document.sform1.email.value == "")
/ N- |' _) U4 \/ v4 s2 @; [/ [ {
5 S$ }7 s7 f+ P* t alert("请输入您的E-MAIL地址");
* q1 d$ i0 \# Y. a2 W; E- X document.sform1.email.focus(); ! D+ y G4 E; V. X$ z' m
return false;
) s. V: m3 R3 N }
& s, G& S6 d& b4 o+ B7 w, Z
! r" q S7 E& ?$ F" m" f7 g. U email=document.sform1.email.value; 8 F$ y1 I5 a! c% }- t- z
emailerr=0 $ ]6 r# t/ a" I7 K0 s6 F& I+ n
for (i=0; i<email.length; i++) 4 l* E w) |7 m$ T
{
$ Q; S5 h; G9 Y6 `% O if ((email.charAt(i) == "@") & (email.length > 5)) ' g9 }% N" C1 ^" t
{
4 J. R) y( m5 P' [: n* g emailerr=emailerr+1
% h6 N- u2 G/ g" l& w }
# a, @/ t8 l: [6 I' y: [ } " P% J0 w/ f0 F, C
if (emailerr != 1) ' I: L6 M5 c5 @; B6 b" a
{ ' z2 d1 C0 R; e9 D, J4 N3 E
alert("请输入正确的E-MAIL地址");
/ W- X! o* O* X document.sform1.email.focus(); 3 i/ u$ E5 K2 f' U# |
return false;
/ }3 s. o, U" Z" N$ X m } . W) d( ^1 o0 e% t
" \ p: s, e+ |( e if (document.sform1.checkask.value=="")
1 ?& K( y/ q9 ? p* s- [# U, H {
* q5 U) z4 ?/ B- Z' s7 U alert("密码提示问题不能为空");
: @! R7 C, N% A$ [, y: { document.sform1.checkask.focus();
, W) O" K3 I$ @4 V3 T return false;
, V; G1 j4 H8 r- l7 e- y* f$ T } ' d3 f5 p3 L( y% h, }+ S! P: A
if (document.sform1.checkans.value=="")
/ k( @6 h9 N v4 }" \ { ; ]0 g3 b2 u* n! o0 a+ ~' j
alert("您的密码提示问题答案不能为空"); 4 c% _! ]0 U* b! q$ f
document.sform1.checkans.focus(); + J' L: {1 G+ `* |0 S& k9 |6 I* {: U
return false; 2 e7 s( J0 m! V: }
}8 h/ k* J: o7 c
return true;
- c1 X+ `+ q- C9 g4 l9 t. P- } ! U6 g& `' L% q# W
} 0 Y/ L C8 _% `
</script> |
|