|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:, D# b6 R0 t/ {5 [5 |% ^" V/ p
<script language="javascript"> ) @- ~" Y! U: [1 ?4 I- V) f
function IsDigit(cCheck) 2 Y" f* q; P4 Q2 f
{ , U, E! K4 A* G/ B% B1 @! m; ], _
return (('0'<=cCheck) && (cCheck<='9'));
" d" g$ N! L9 M0 x+ j }
( ^) C! j. w: q
. W9 D% X2 p- {6 m Cfunction IsAlpha(cCheck)
: q/ `1 \* T: m; ~ w- A {
* c* z+ p( O: C# r" k return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ' |8 J& w! D& j' c% s q }
} ( u6 J( `) b! R4 S# @0 y7 }
$ z9 L! [3 _% x- _2 x9 T. Z# ~* Dfunction IsaNull(cCheck) * a' I6 ? B( I7 ]( u) R
{ 9 m8 o6 L* [/ E* ?, O
return(cCheck != " ")
; A$ p" H( F" ]7 e# V5 J/ V! K } : D/ }8 F2 r7 X, G# y6 c
. X( b: o$ J' u1 n
function checkform() 6 V: }5 h. i, z
{ 8 n: @9 \# P' J7 f1 B0 r
id = document.sform1.id.value;
: T2 w/ w" I- B1 F' c if (id == "") * [! n2 H5 B. t' R# Z/ e
{
' Z) G* q2 I J alert("请输入注册名"); 7 M) K5 Z( r- q- R% m
document.sform1.id.focus();
6 ^! v" H, K0 r7 v+ Y return false; $ [3 ]/ `( t0 Q! b3 }
} 4 l; w t' ?5 ~2 R* e
. `2 x8 z1 H9 H2 O" I for (nIndex=0; nIndex<id.length; nIndex++)
4 x& o) {* y: O! Z9 c& c9 z {
0 a" Y) ?4 {2 J8 m L9 `" l2 A8 _ cCheck = id.charAt(nIndex);
/ L. y! o$ R9 d( D+ b6 P' u if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 8 [$ M+ }- A$ S- w
{
0 H, r/ E7 w# d' Y- x# z# j- { alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); # k. J, t* n5 `( D5 E3 k
document.sform1.id.focus(); 2 \' @/ h+ k) s D/ [
return false;
, A, {* I1 F& z }
; [" @6 z9 n7 |& I } 5 n9 ?. p' J& N
chineseid = document.sform1.chineseid.value; + R$ F+ G+ L1 D$ n0 w" g4 t+ P
if (chineseid == "")
' D6 [. n$ z d6 p0 b9 D {
. K& F( W+ E* e- I alert("请输入中文昵称"); 0 m$ E$ H( ]; {# l$ a) Q c$ h: h
document.sform1.chineseid.focus();
6 `. d) o1 s+ M' T: |1 ~ return false; / I' b4 ~0 I6 M0 [$ r* Y
} 0 Z3 B- u+ N' p9 `# _
password = document.sform1.password.value;
! j! b2 `2 d! ^6 [% g) u, k; D if (password == "")
2 g3 t" ^: W. B: r# w# X/ ?' o {
3 g5 m6 T+ I6 d1 p alert("请输入登陆密码"); 1 b: v3 n( N1 v9 q @; v- ]0 p
document.sform1.password.focus(); 9 t5 ]$ x! q' D, P6 j
return false; ' {$ c) i3 U$ x2 v6 g/ z) O
}
, ]" W6 N1 w! V( k( c( G password1 = document.sform1.password1.value;
# }1 k' `! m' c! O; Z if (password>password1) 5 _# Z- i6 U$ X! b
{1 J0 y) f* H/ @: ~+ R
alert("重复密码与登陆密码不相同"); * o _0 k0 n: |# @
document.sform1.password.focus(); : m1 n3 J1 Q" @" u
document.sform1.password1.focus();
. Z5 J! P/ n: H; ^/ V( [1 R return false;
3 M ^3 ^, A9 f } - }/ b5 m6 M5 a6 k
if (password<password1) l3 b1 i; G- M: V1 p
{& b, X4 O( T# H7 g) _
alert("重复密码与登陆密码不相同"); ! a* x& R i" L( T
document.sform1.password.focus();
# f6 r2 o {& v: e U4 T8 y document.sform1.password1.focus();
$ ^& y a& @, q8 a' r return false;
0 z. R8 w1 T. p8 f; J } & W" v3 a+ q/ n' Z% e' e
if (document.sform1.email.value == "") * e2 Q3 p$ A+ j2 N2 D4 L
{ # f2 N5 w W$ e- ]( S+ m, X
alert("请输入您的E-MAIL地址");
2 L, d: z/ y( R$ x document.sform1.email.focus();
7 V9 p5 A& Q: q3 G. l return false; ) o6 q# g' e# k$ G+ {- X7 i9 Q$ X
}
3 f0 H& a% ~% |
# p# M( v2 e$ G email=document.sform1.email.value;
; t$ [6 n; B: ^6 N5 \0 B% u emailerr=0
" A' ^* b: G/ h& P+ y for (i=0; i<email.length; i++)
" O+ \, L! k9 ~* p; t" A { 7 ]# g8 p' z8 n8 s5 c
if ((email.charAt(i) == "@") & (email.length > 5)) 7 p8 R1 i& }) a9 i, `2 l Z: c
{
5 r. x. N: c% S emailerr=emailerr+1
; [' q& T$ M8 F2 u3 a } " j/ }4 v8 r* ~+ ~) _
}
( U7 Y5 [- R7 ^! L! E5 ~ if (emailerr != 1) 4 J* V J+ F8 J6 K% f- a2 v' U
{ $ D+ B. M; l! z, d* j; B
alert("请输入正确的E-MAIL地址");
6 o$ H' c: X& B9 P$ E( Z document.sform1.email.focus(); * O6 k5 S" U/ v# w# `; ^3 b; ?
return false; 9 q3 M& f4 D9 W2 k* n9 N
} * y8 Y9 G% `8 t0 Y, W; H. z
6 Z5 I. B' d: k# [# @ b if (document.sform1.checkask.value=="")
/ Y4 E# L# M+ p& y7 ? { q& E* Q4 W3 ~- z; _$ h
alert("密码提示问题不能为空");
, ], b1 k: h+ r6 T" B8 r& k C! e document.sform1.checkask.focus();
) V: J7 R9 [' r' [1 w return false; D: E! c0 _ H
}
( e: Y$ |, \8 `5 B% D' v* F if (document.sform1.checkans.value=="") * T+ E9 O7 |: r1 {/ i
{ / h1 y! `& f/ w* w
alert("您的密码提示问题答案不能为空"); 7 \; f5 b$ Y f; ]$ h
document.sform1.checkans.focus(); 5 ?# r+ N/ u+ K: ]0 s& s) f* q; K6 g0 _
return false; 4 b- g4 [; j. m
}
; F# A' R+ s5 P+ P) y! ~ return true;
6 A2 d, e6 g* w! }/ U6 U$ H 2 F5 W* M1 p" g( \9 y% J* I+ c+ Q4 z- F
}
8 h3 v. Q2 g. F2 D' `</script> |
|