|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14385
- 金币
- 2478
- 威望
- 1647
- 贡献
- 1426
|
这个脚本对你可能有帮助:5 j& }3 q3 D) y2 t3 ]% h: L- A
<script language="javascript">
1 ~# w8 @0 L6 {+ u( mfunction IsDigit(cCheck) : Y/ s; O& G5 P9 [
{
- r! C. {( \7 D3 D return (('0'<=cCheck) && (cCheck<='9'));
1 O a9 d3 v% u; P: n }
' J$ }, F% N6 e! h: | & B$ T) g1 s, h& D9 p$ r( _9 {
function IsAlpha(cCheck) % C$ }, R( ^ `( p9 q4 V
{ & |0 u6 y7 [: t( j* s
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
: s0 s' c: m0 R# Q; r$ s6 D$ ^& _ }
& v( j6 x( K6 R% w4 C. n+ X" t
( p9 C) O& O3 u( E+ Y* V" q. v7 `function IsaNull(cCheck)
7 t: Q) A: L+ [* C { 2 h- G! x* I5 v* z: \; g+ v) j3 t9 f
return(cCheck != " ")
0 Q5 M' r; w% c0 Q2 t! z }
9 [: U, K, L' S/ y
7 m X( d1 c' {1 b( H! E( Vfunction checkform()
]/ o0 s% Y7 _3 y7 B: C{
/ q- q. c4 G: H9 A, |1 m" q6 ~) f id = document.sform1.id.value; K) T( [9 T6 B ~# p$ z# d. d# ?+ `
if (id == "") % ?) o+ Z9 N# T$ P9 D6 u. b
{ / @1 w* n, ]3 k+ {% N7 S+ V- I% i
alert("请输入注册名");
2 h1 S% S0 Z: v# t document.sform1.id.focus(); 5 `. k# F8 ~, O+ c
return false; $ W g/ _8 G0 m9 [, e- g* z
} % Y% i4 B$ v7 O
A' L' T4 U! Z1 ?! K
for (nIndex=0; nIndex<id.length; nIndex++) + a( {3 ]+ m5 Z6 l# A
{
9 I, ?1 ^+ e1 t. J cCheck = id.charAt(nIndex);
( `2 d% B4 }7 B4 v8 c& E7 S4 P i if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
, B% q9 p& ~) S& l1 t { 2 h1 d6 V5 N2 }
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - `& p0 {* H: t) l
document.sform1.id.focus(); # d% i- x$ C" Z: _/ I$ |( v: U4 O
return false;
, d; M# g5 ~7 @7 v" k1 Y8 y } . q" J0 r; m$ g! T! x& f+ {& x' _5 g
} , g+ U& ~3 Z L) W# S- Q! {# r
chineseid = document.sform1.chineseid.value;
% S+ k# S/ B4 R g if (chineseid == "")
3 ^) j; ^' H4 \4 ?( O2 g5 \ {
$ w7 f2 D% h, h( b! k1 V3 g alert("请输入中文昵称"); w8 l5 T. k. h- h& @% @: w, f. A1 Z
document.sform1.chineseid.focus(); 1 ]( n9 [+ Z4 h( L' e4 ?& Y
return false; ; J8 H# V" F6 C' `0 X' l+ S' b: o
}
; d1 \ n0 N* m- _% B8 k! U password = document.sform1.password.value;
- q; v, ^( Q) M4 H) g; j5 n6 {: a. t if (password == "")
$ O5 J M. f) J/ w+ ` { . ]7 K: y) X8 v2 v5 u/ h8 u9 H2 K9 f
alert("请输入登陆密码"); ! o1 z. `" E# t! y( L* Y( a! ~
document.sform1.password.focus();
& _8 l/ [$ |+ A& G return false; 2 V, B7 W6 q" r2 d* L
} , A+ h2 B- b: l
password1 = document.sform1.password1.value; $ |3 m# X- I6 ^1 w
if (password>password1) , U7 ]2 q3 c; L$ F6 r
{
9 h: ~% M& T7 ~) f3 ?3 @ alert("重复密码与登陆密码不相同"); + u0 k" P/ n: U3 A A4 x
document.sform1.password.focus();
9 ?$ v2 q$ ~9 T+ H document.sform1.password1.focus();
- y1 K2 W! _1 E8 T6 t! A return false;
) x R- R( q% _& Y& n# @6 @ }
! E* l7 o, _( u% Oif (password<password1) ; C$ Y: k) Q3 F) M0 t2 B# X
{4 X. [3 D/ ]+ n7 e
alert("重复密码与登陆密码不相同"); 7 s8 n8 D2 ]3 f6 S: U
document.sform1.password.focus();
' F1 Z8 D9 j( b% \0 ~ document.sform1.password1.focus(); : c9 V& k, f3 g5 E2 W
return false;
- d) X, R$ Z! p- [) Y ?0 K. k }
6 C7 V/ P/ G& z$ C if (document.sform1.email.value == "") 8 g2 ~- m! V2 _+ c
{
& _8 f) E7 Q; i' K* z M alert("请输入您的E-MAIL地址");
: e( o" j! N9 ~! Z3 J document.sform1.email.focus();
2 b" d' |" E3 V, r; K' m- W, \ return false;
5 e0 Q5 G( n4 h; } }
+ D7 j2 M8 ]- l3 c 6 C" z% _+ d" d2 Y
email=document.sform1.email.value;
* G5 R6 W4 D- \, X1 T# C. x7 S9 m/ s% W, ] emailerr=0
5 A! D0 |+ T2 i7 O for (i=0; i<email.length; i++)
`/ _0 h' {* j0 t# b$ o, n { / V0 [% S/ m! w l
if ((email.charAt(i) == "@") & (email.length > 5))
! X! a$ v) F, U2 W9 {- t- }. W {
$ K+ e4 K3 }3 l; c# U$ ^ g emailerr=emailerr+1 7 k- P. @( s) R$ `/ e( E3 \1 A
} 9 C {% A0 @/ \( x. V% Z, ~6 f
}
5 q; n1 B. i2 `5 q T) T+ [ if (emailerr != 1) - B5 W1 K. s+ n- l' r- N- I5 t
{
. P/ J* c. w: }* j) l) Q alert("请输入正确的E-MAIL地址"); 0 Y( p V% U6 i! A; ^
document.sform1.email.focus(); , i9 ~$ F; _' `0 q4 u# `% A k: J) g
return false;
3 k7 `& {6 I5 G0 U; T( J+ N% C } 1 s* l& M3 K" g- R: n+ e3 U
$ @/ b# M: w+ X2 R if (document.sform1.checkask.value=="") ' j H2 G! }% e) M
{ ; }3 m$ R" R3 F4 S9 [- i5 A
alert("密码提示问题不能为空");
- b: G) ?9 P) y9 Z5 M; f- m) G! p document.sform1.checkask.focus();
! V L# {* }8 t: s* \# A& N( G return false; : _* k/ O5 ]0 W2 w" l, G, c8 C
} 3 m* S2 ]; X+ m4 V/ {" ^) L
if (document.sform1.checkans.value=="") 9 D/ M; z- A ~, \
{
, C7 Y8 S( b( e+ ^) i5 d$ ? alert("您的密码提示问题答案不能为空"); , x6 F, a& k, r7 b$ S7 \7 K3 ~
document.sform1.checkans.focus();
" X6 q* z. {8 P3 W1 d% w return false; 0 M- u* u3 i- @# \
}
j% N& Q/ C2 d1 h return true; $ d- B# S( q% ^' W
0 J" z1 [, v( [: I# j, @0 ^
} + r7 ]% F. S9 Z" P
</script> |
|