|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14403
- 金币
- 2487
- 威望
- 1647
- 贡献
- 1435
|
这个脚本对你可能有帮助:
$ Z8 T- r& t5 E. T( |0 I<script language="javascript">
( s1 A: z. I: J3 ^3 _function IsDigit(cCheck) & m1 w6 G' z4 o: l0 ^: u
{
4 q) _, [* l3 a7 ]/ }+ E7 I {" Q return (('0'<=cCheck) && (cCheck<='9')); H. H0 D4 e/ y8 n7 X0 A( V
}
, x. j. A/ c) F# H
; y6 b: @5 L6 Y; x( _function IsAlpha(cCheck)
3 l* I9 g0 S, }! e1 V { 6 l! b9 R# g" a7 n
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ; m, l1 z: D7 I3 y6 I/ P% u/ G6 G# E
}
% l7 F, g9 e9 s1 D. x # d% G7 ? a! {! @' J
function IsaNull(cCheck)
6 i/ t) W; S$ s2 R6 b6 {& r { + ?1 b# w; k% b
return(cCheck != " ") 8 o9 x0 {/ a4 U, U. x; U
}
" F* R1 U7 b5 G! L7 ^
0 h: @% x8 C- r6 `5 l. lfunction checkform() 8 E8 Z" g7 f# E* \
{ 4 z. F' N! R) o" U
id = document.sform1.id.value;
- r. o" w) k, ^( x4 [2 G: @ if (id == "")
; y7 t5 y, n6 S! s* O { ' H+ I1 t% o" x2 c5 v
alert("请输入注册名");
2 o2 |0 l& e1 W: \$ D+ x document.sform1.id.focus();
) V' [- M! [# B7 V return false;
: v" R5 m, R9 V, H4 b8 E }
5 b% w- g ` R3 F' p, z/ `, P
2 k9 E7 B, t5 k1 D! a for (nIndex=0; nIndex<id.length; nIndex++)
/ x% P, |9 [% R0 m) N. P- Q. T {
/ u0 N& z, |( F+ L( y% I9 L6 u: @ cCheck = id.charAt(nIndex);
, b% h" R# @. h1 N3 r* z* s if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 3 U% z' V; G: q9 u
{
9 D$ i- w" R/ s2 U* t+ s alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
5 p& N6 _( }8 y! }4 G( ^ document.sform1.id.focus();
; }7 f& i7 O; b& e9 c& F$ }! F return false;
4 T! @# A) |- {* S } ! U; m( P c8 c1 f" Q
} K# i+ h9 y' z
chineseid = document.sform1.chineseid.value;
5 c' e: k8 Z5 m1 R2 v& x# S if (chineseid == "")
/ O- `: _! [1 d4 f5 z {
/ f& K! |0 K( \5 _. \" O8 P, y+ P alert("请输入中文昵称");
|5 g6 F1 ~' H# J/ Z* y document.sform1.chineseid.focus(); - b6 Z# p' t, |( m% |
return false; 0 k( A5 @ G; N
} 9 t+ g% ^ S0 o7 G
password = document.sform1.password.value; 8 q2 F v3 \/ O- k7 {
if (password == "")
" S* Y4 z: A/ E+ R {
7 X( e/ U. E! y5 g alert("请输入登陆密码"); 9 e. k% B- J# Z
document.sform1.password.focus();
8 q. I" O; |4 e/ ^" | return false; 9 M' b& r1 \- N. U( ^- ?1 ~
}
9 j& ] t7 g* l1 H' S2 U) { password1 = document.sform1.password1.value;
/ Z+ ]7 ?6 q z6 q7 y4 t- _" _$ a if (password>password1)
1 m* i; f9 O" j {, o# E4 _) M# x; W. n6 D
alert("重复密码与登陆密码不相同");
* v2 L7 j/ y6 c( o8 ] document.sform1.password.focus();
5 U4 \. F- A( P document.sform1.password1.focus(); 6 l9 J! ^1 ]5 K
return false;
7 t. J1 |3 a9 h3 |3 {0 B }
* F/ z% J( l6 x/ uif (password<password1)
4 _0 v, W* o! C8 | {
5 [& C, }% K8 h: E6 C alert("重复密码与登陆密码不相同"); $ o8 p5 E1 c/ T) U# H6 u' H5 c8 q
document.sform1.password.focus(); " o) S% c, `% d, J, S v7 Y o
document.sform1.password1.focus();
p5 d# x$ m! U @ return false;
5 |( [ B y" O/ ^ } 7 q4 l' G7 C V: E. `; s: a% C
if (document.sform1.email.value == "") # [ r; A) v# _5 e m6 d
{
/ E2 h/ g- | W3 m7 `& D) I6 h alert("请输入您的E-MAIL地址");
r' p. w+ `6 u0 }! @4 G* z document.sform1.email.focus();
9 q2 S5 V6 z9 ^5 S return false; 7 _0 Y; y. H# a3 Y
}
8 _+ D( ?! R- {
: i! z N9 T, e- @2 B email=document.sform1.email.value;
" H! Z& _: ` ]6 e* z( v emailerr=0
6 P" ], i/ F. u( d/ f! p, t for (i=0; i<email.length; i++)
1 j' X9 ?& @2 H- @9 ?5 ^/ [6 V {
. ^: O1 k# P, ]( E! r h if ((email.charAt(i) == "@") & (email.length > 5))
% I( B) @# B4 c+ D/ _! ?, w { $ _2 Z3 ^+ j; P3 [4 k
emailerr=emailerr+1
/ [. ~1 d8 k; i* W: Q: W- Q6 t0 D# C4 `" q } & e; \! @) V( t' h1 v$ }2 P( C- E
} 3 h# y$ \, Q/ k3 x' s( N7 ]- f2 v* u
if (emailerr != 1)
" V" U$ B5 r4 @1 s& |& a8 i% q* _ {
0 M6 c0 Z8 O! @ alert("请输入正确的E-MAIL地址");
1 ^! z9 T- i |8 U document.sform1.email.focus(); # h# y4 z7 [0 C4 P/ I3 }
return false;
* m0 Z% ^- M$ b7 S9 X: O } z: ]9 t$ X K, I7 T
. i! ]" r% q4 s# [ if (document.sform1.checkask.value=="") 0 K, Z3 s0 l* G- x$ I, I
{ , U, ~" G# p O* n
alert("密码提示问题不能为空");
9 L. L" D$ T. a V) a, r; s' F document.sform1.checkask.focus(); l. j1 E! e9 \
return false; . Z3 T+ f7 R( w
}
7 U, [0 A- U' V) `8 _ if (document.sform1.checkans.value=="") 8 j. U+ l# i( G+ k
{
: h8 R1 y" E! U+ c [0 w- A alert("您的密码提示问题答案不能为空");
1 }1 D4 R* s W l; U9 O1 C6 M% M document.sform1.checkans.focus();
$ `' J- Z2 ]6 W6 Z0 ^$ U: { return false;
+ _4 \3 l8 W" H. h. u }
9 Y# ]9 x. i$ X! n4 x: L* ~3 k return true;
* ]6 c% S; w) Q1 l( l$ y3 T . C5 k ~1 ~, }5 |- [' P; {* p
} - s( ?( U) k& s5 J |5 D5 l
</script> |
|