  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14249
- 金币
- 2415
- 威望
- 1647
- 贡献
- 1363
|
这个脚本对你可能有帮助:
# A6 C- _- p& K& {. d: y<script language="javascript"> 2 s" i( ?& \ S2 U9 B: A
function IsDigit(cCheck) " y( v+ k4 o2 S% M( W
{ 9 j9 M. j1 L& L5 c) A
return (('0'<=cCheck) && (cCheck<='9'));
- i+ D! u4 ]* C/ n& {8 N3 H# P* m } * E6 U8 u- W* H" y/ ` g
O/ O6 \5 v/ v4 v9 F Dfunction IsAlpha(cCheck)
9 `! X2 [, c+ A. z$ P1 b1 R {
' Y% J- V8 B4 K y1 w return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
( v2 W* e) q+ U$ I- s }
- u5 q; z! z& _) M5 d6 X & @1 s+ I$ l7 E4 L
function IsaNull(cCheck)
" N# ]! Z. Z" m' [% o6 \/ R { ( y) G! o! U a h
return(cCheck != " ")
, Q# |5 T- m8 F( G } - e; ]4 K% b1 A Q: X; x. Q! c7 {! v
2 z: ?' h4 r0 N$ ^! S2 X k; [0 C
function checkform()
% g$ @+ B4 N G+ r, F* L7 E{ $ J, L8 b6 u. t, B" R
id = document.sform1.id.value; 5 K$ y6 S* R( |6 `' k! H# Q4 ]
if (id == "") ! I5 D+ R* o$ u- o& p
{
/ G+ h. k6 m4 X$ f0 V alert("请输入注册名"); - x& n' Y/ x$ x7 ~9 t; g2 q9 X
document.sform1.id.focus();
2 q: `; z: p4 O @& f* v return false; ; ^) |0 }( k8 Y7 n
} $ L/ V \$ \7 D/ q# U5 z: X
' C+ N0 V4 `( L! u6 i: D for (nIndex=0; nIndex<id.length; nIndex++) 6 T7 P0 v. W* w3 d
{
4 m! E p. D! a cCheck = id.charAt(nIndex); : c' U) G& T& e. ^
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
* A. F; a" a, J+ r% l { * e1 t2 _" Y3 |- ^6 O
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
! Z' u% a% Z# d; c! c document.sform1.id.focus();
* E0 }3 j! t5 i; r; R return false;
5 H# [2 m. r& j! g+ P% _ }
1 ]5 ?" e5 e$ E# Z+ c } + Q& s8 ~2 O6 J* m. g- _7 X5 @
chineseid = document.sform1.chineseid.value;
: V! J9 y7 B1 x0 l7 S2 t if (chineseid == "")
S- C4 J/ \, u# V# N { ) S$ `# L) N8 J5 r L
alert("请输入中文昵称");
+ H4 C2 B; c) w$ Y; T J* E7 b document.sform1.chineseid.focus();
, T* r$ X7 G% ?& o+ b; Y) S+ S return false; * u! b) E$ _! Y9 A7 d" u7 v% P
}
; a' |( {: @& O: i0 Y/ V: k password = document.sform1.password.value; ! G* s- I* u9 r: r# T0 L: T
if (password == "") " @, ^4 y: C- ^# b! J
{
: K1 b$ ?1 v, R alert("请输入登陆密码");
@9 t6 H( [% k3 X2 R document.sform1.password.focus();
8 \8 R1 y; E+ c* G: E t, o7 D return false; 1 E) S5 ^; E8 ~* N
} / |* f- \5 L9 ?6 m9 f
password1 = document.sform1.password1.value;
& W/ x0 [# F! b% s if (password>password1)
& q0 R o/ H/ q4 i( x1 V9 Y# ~ {, J5 N* v, R0 V# z( ]
alert("重复密码与登陆密码不相同");
. t N" |9 O5 L7 v document.sform1.password.focus(); $ q/ ]& w n: o* n* Q
document.sform1.password1.focus(); ) |3 }( Z$ E8 x: u
return false;) P" e3 _7 [4 T5 n4 |5 |
} 5 M+ H6 @% C& ^. W9 V- d9 w
if (password<password1)
9 y: r: t9 |: n4 p3 t {
8 D! f! }5 v7 v) { alert("重复密码与登陆密码不相同");
* R6 }2 R8 R3 W, b: p6 w: x document.sform1.password.focus();
% V& h$ |7 r. L+ ]! c" g6 ~ document.sform1.password1.focus();
. p% {: B% Q' l4 }9 ~ return false; q. {3 j! l) }0 ]& _
} - s }. R9 \9 p! b* v. y4 u
if (document.sform1.email.value == "")
0 v8 Y; X y( f {
% ?- z* q' Y- H- A alert("请输入您的E-MAIL地址"); m3 s3 i# i) S; O
document.sform1.email.focus(); ) g% o3 D0 a9 D& x% `7 i
return false;
! G3 ~, p/ C+ x1 v- ~ }
3 T) v i x" @! N" }; k
9 _, E5 ~+ G# [# V% F' x# K; z' D email=document.sform1.email.value; . G* b' T Z6 O3 W, ?7 s
emailerr=0
8 b: P' x+ {, t4 w1 F' w for (i=0; i<email.length; i++) & \7 j. W- ~& @8 c$ w
{
* ]6 W5 Q8 R+ c! W; e if ((email.charAt(i) == "@") & (email.length > 5)) * F# k) j, m1 }6 E0 {' Q
{
% U% m# x% ?! ^. X emailerr=emailerr+1 , l. M8 ?# x; y! l0 M) F, k
}
5 u1 a H/ x& z0 @# Q8 |0 O, p } : a# ?$ V; Y8 Y& h
if (emailerr != 1)
" P) s- b( Y. f- |+ _: }! {4 w5 w { ) @$ A6 v- J1 M _' L
alert("请输入正确的E-MAIL地址"); 6 M$ q1 \9 r7 {
document.sform1.email.focus(); 9 w0 t" O5 w0 W: A9 u; V, L1 l
return false; 0 S5 a% A% }3 F2 |/ u0 l$ O# v. V
}
1 N6 _. v4 n2 E' M2 Q
. _* V6 @/ }4 C8 }7 V; k" h, ? if (document.sform1.checkask.value=="")
; `0 J% m4 d; a" H {
# Z4 U. l& r$ }8 n alert("密码提示问题不能为空");
4 O2 o" u; d2 [) E# Z5 c: `" g document.sform1.checkask.focus();
7 V$ O# K/ X1 `" Q' V return false; ' i) r8 b# a4 N& @( N. v: Q
} 5 v/ a. |2 i8 J9 l. X# K% o
if (document.sform1.checkans.value=="") 5 i/ b2 J9 c+ w' }# ^( u" J
{
, W6 i0 G8 U# u' F5 b" C% Z# K alert("您的密码提示问题答案不能为空");
+ }% x% U4 P- w3 f+ | document.sform1.checkans.focus(); 6 F) v8 q1 t$ T3 }+ }$ W6 o
return false;
3 E6 R6 I5 `* r) U3 D }
2 E; @, C+ W0 Q- H; G: Q return true; 9 _* ~, f& A! { y ]( p) @2 u
& c+ X$ X2 w7 g} ) Y- d: u8 Y$ Q- E: \7 Y7 b
</script> |
|