|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:! D5 ^2 K4 Y4 \2 N" z* C
<script language="javascript">
$ ?/ \5 `- X xfunction IsDigit(cCheck)
) D6 L3 b" J# p+ \ G% R { 1 A( Q9 x2 M3 G. }7 ~- O& k" B
return (('0'<=cCheck) && (cCheck<='9'));
) `4 e! d( Q$ ?9 f9 J } * p' v4 M+ Y! x0 R& S8 ~7 X$ K }
! Q. U X0 g+ \# U
function IsAlpha(cCheck) 7 y( b$ K) Y( F5 H. g
{ - v& w9 q& S5 A* v
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) - B, }% B% ^# B) X7 f. U. b, ^
} 1 S& g/ u8 J( p
0 K- u" Q- i- s9 g: s( a" [
function IsaNull(cCheck) + a# ` ]. D% e% {6 d
{
6 v" S1 t) j; M5 n! r return(cCheck != " ") 9 h( W( V# |0 N
}
/ E3 \$ J3 Y6 E- a; V% C# K8 W
' M- f9 w1 E, k( @, |function checkform() 8 ]% A" Q: N* F6 D! E2 E: n
{ , w3 c h3 j" b1 F
id = document.sform1.id.value; , S/ F( D( D O5 P4 R$ S* v* Y
if (id == "")
7 P I0 Y# [$ b {
9 q* O; D1 y; y, y alert("请输入注册名");
) {7 L2 H' X& Q3 N* `% y r document.sform1.id.focus();
! V& O. v% H$ e' b% c# t$ _; [ return false; + H, K- L- u+ T. |
} ( F$ p, Q7 W$ j8 q, x' B
2 i6 z8 p( X7 ]- [8 w0 U
for (nIndex=0; nIndex<id.length; nIndex++)
. d$ Y; A! f; |1 V% U$ U {
* v: b' Z" I0 _/ l7 Q" ` cCheck = id.charAt(nIndex); : j- e w; Q' m' ~3 h
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
6 ~1 K& Y& w+ E( \: F# F/ f {
7 j/ B: X3 ?, N1 g3 ] alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
0 d L8 k, h2 G2 \$ t+ i document.sform1.id.focus(); c% B# I0 s* o
return false;
6 @. \: g6 d6 _ } * D. t9 L8 m, V9 b3 ~1 G' B/ k
} $ n/ b4 e% g" }+ Q8 |1 Z/ _7 S* U
chineseid = document.sform1.chineseid.value;
" Y& s0 [3 O. }5 H4 _& q: H; N7 C& I if (chineseid == "")
* e. n9 m1 P. `! l# u { : ?/ a3 T2 H, c; m$ N' G" }" i
alert("请输入中文昵称");
9 `) f: `- i# h( q0 ]7 r+ l document.sform1.chineseid.focus();
! w) c( @! V" {( I9 s return false;
! k( ~+ v3 D' A# S4 [# x h8 v- p0 p }
8 T, y1 t, K+ `+ b password = document.sform1.password.value;
4 N) i, U- C( B- ~: R8 a! h6 y6 ? if (password == "")
: J5 G& s, c# `5 j) x9 c% x2 g \6 K { , T. R) h, h- i9 Q+ S C F" I% Z
alert("请输入登陆密码");
# U9 t: z! I# j8 \0 u0 L4 `+ ` document.sform1.password.focus();
: g& d: W2 L" I. p8 w2 v* Z1 _ return false; ! v& J7 m9 v0 ~* B
}
! D+ M7 B3 r+ F, } password1 = document.sform1.password1.value; $ l( V( \# i; K( g5 D
if (password>password1)
1 `. x! j: J U! e3 u7 ] {
G! u; N/ M2 J# ~) C! | alert("重复密码与登陆密码不相同"); S/ a/ R: T7 _. ^5 f0 ~- ?# d( e
document.sform1.password.focus(); 0 x) i3 O9 i2 A& A% w6 D
document.sform1.password1.focus(); 0 ^5 [6 i% v$ s; S) y4 W3 O
return false;
! a) [' F4 ~: R0 a8 ^ } : A4 B3 w4 n$ ]$ K$ z0 {
if (password<password1) ) b. }" f4 n% A. R5 D3 X
{
' |* R- U4 g& e1 q6 |. d) a alert("重复密码与登陆密码不相同"); + {/ r5 `' i; `) o6 X
document.sform1.password.focus();
1 p0 V& K/ w- f/ i; K0 A8 G document.sform1.password1.focus();
3 q0 ]. ?" U; q8 `) @! z K return false;
; g( `1 F# T! y% D! w% W }
+ A( _3 `( h/ y5 `/ K0 ` [; \' E if (document.sform1.email.value == "")
' \- a! {) Q' g1 H+ W" I {
; [# k5 P* Z% o) P8 k& b1 A2 i alert("请输入您的E-MAIL地址");
+ y0 B& \9 N( m% \ document.sform1.email.focus();
% X; U- w. H) e return false;
& x4 ]1 L& ^5 B% F2 \ P } * ^! y( \7 C2 K8 o
2 T( M; V- g2 D s- X C
email=document.sform1.email.value; " t( C0 \: V2 E
emailerr=0 4 ^8 V5 B, K7 ]- P
for (i=0; i<email.length; i++) 3 |4 Y& @- g/ W' k2 C
{
4 p0 u) b4 G. O( W3 d/ V' y' f if ((email.charAt(i) == "@") & (email.length > 5)) 6 I2 Z7 N8 w7 J; {0 z: D0 S1 N& l! n
{ S" F. w; }- @! ^0 b
emailerr=emailerr+1 O( U# B: \8 B; Z7 S! G1 Y, T- v
} i, G$ n( u" I5 q8 [# _
}
6 U5 u$ g' C$ R9 A if (emailerr != 1)
/ t; i- _' ?. P {
- j' z9 n) u- t4 c( d alert("请输入正确的E-MAIL地址");
5 }2 J! ~2 @. W. x& z document.sform1.email.focus();
4 U1 X% ^6 U. O- a" s return false;
( C4 a0 l4 ^0 D: |4 |$ `3 q }
3 N C [# \+ M4 A$ K
8 ?! G0 ?: B1 X. A- K" w if (document.sform1.checkask.value=="") ) C. j3 l9 H3 D2 m3 S0 h* A/ N
{
4 T7 k- O/ z1 H$ D z8 ~3 S- e# e alert("密码提示问题不能为空");
. s" U+ k8 A$ L3 O- K: h+ Z6 w document.sform1.checkask.focus();
# @% |8 s T$ O0 m' p" \3 A return false;
5 S* O/ J* H" ?: b }
- y0 J6 T8 L" U/ Z4 Y) X if (document.sform1.checkans.value=="")
5 P% P0 i+ r4 |$ u6 R' y {
9 t! B) J1 Y, r+ z8 A alert("您的密码提示问题答案不能为空");
9 E% _6 u' t e/ m3 g document.sform1.checkans.focus();
& c3 ~) t+ Z: e return false;
- A, q) g2 N. z: ^7 C) Q }
# D2 Y/ I _+ E9 R return true;
2 Y$ O8 j. r+ F. H# I 0 W+ ]8 H( u! |* i" o& `- N
}
, Z4 _2 i/ g+ y- W- X( y* O2 o9 w* W' h</script> |
|