|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
这个脚本对你可能有帮助:
7 G9 M3 P( y+ c* r0 X* ^$ | }7 R<script language="javascript"> ) o/ t' I- F; l
function IsDigit(cCheck) 4 ]4 T8 \% P: D" x% p( E
{
# O/ D; [/ h# t2 x1 i0 I( Z return (('0'<=cCheck) && (cCheck<='9'));
2 W% R% n' I9 z }
4 L$ ~( X( t7 r. G; x 5 r( G* Y, E) ?. `% T; p* s
function IsAlpha(cCheck)
1 X1 k2 y; u) B0 N6 r2 _ {
: ]7 Y# a( Y. C5 m# [ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" b7 w8 X+ h( B9 l- w8 h8 ^3 v' c }
) ~( Q% S$ b# M: P" p 3 `* V) A. F! h2 F& m
function IsaNull(cCheck) / m; D& t* }4 r N, W
{
" I; ~9 E* e% _& B return(cCheck != " ") # k; G7 L1 {, A- b8 {0 V: q
}
0 x7 x3 X5 ?: D: `+ a$ R
) R/ L. l3 }! P8 e( xfunction checkform()
# Y$ |2 u% T1 C' D( \$ a{
W# r/ r6 j: R id = document.sform1.id.value;
% K9 g- c9 a# w! y3 h if (id == "")
. m4 _3 u) h9 I/ n6 M( l! p { L V3 X1 s# o. Q8 o6 w
alert("请输入注册名");
" S; C9 ]- V5 r0 _( [ document.sform1.id.focus(); ' v7 `' b. [; W% q
return false; : C' I2 x' i. A5 A. M2 V% @
}
) F# y6 ^5 d! z* r* x7 h! i ' K; }+ V9 E! M+ `: {
for (nIndex=0; nIndex<id.length; nIndex++) ; f& _- H; ^: G
{
. _/ K6 n! O; g' J% L9 Q9 b cCheck = id.charAt(nIndex);
( {, R( k; u; [ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
# X4 z% u4 r* V6 z. F7 g {
; B, a4 }$ Q5 J) h- f& |% M4 k alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); . a$ Z5 m, w. w0 }
document.sform1.id.focus(); ) ?9 j c9 {6 S
return false;
- {9 h6 \9 q! h6 d( t( q9 B6 j } & X) g9 l8 A0 c+ ]% E9 b7 [
}
" K% V* m1 f- |' U chineseid = document.sform1.chineseid.value;
* v' L' ?$ { c2 }+ G$ h if (chineseid == "")
7 _' ^$ f8 n! i4 F6 s7 H {
5 P/ d) n8 }+ J: [! p* l/ t alert("请输入中文昵称");
1 E4 G1 p* W% Q+ L8 A4 Y' F document.sform1.chineseid.focus(); # D0 n- A) k4 H
return false;
+ B5 P# |, K* u7 N: `/ I0 m/ g$ {0 f } - G% L7 g; S" _
password = document.sform1.password.value; 7 P" c; H) a' \5 j g
if (password == "")
$ b% ^8 c4 z! p+ C$ z" J9 Z { 9 ^ i. r- J. m' K; s
alert("请输入登陆密码"); 8 V6 E! P* K. Y3 Z
document.sform1.password.focus(); + O6 Q$ _& n# B- H' U
return false; " x& x; p) W. n- E/ f5 _9 q
}
' O( ^& ]9 K/ z0 g password1 = document.sform1.password1.value;
3 h, E0 M$ d$ m2 Q" p, h if (password>password1) . h9 V ]7 s1 H6 B. }
{
( Z9 c% p+ @! J6 q. P) v) \ alert("重复密码与登陆密码不相同"); N" K3 b' U U# X6 e3 Q
document.sform1.password.focus(); & I, F0 n/ |6 G. k; z6 O$ W
document.sform1.password1.focus();
: Z, I8 k2 k0 E+ X return false;
( i& B9 A# G; {9 \; T4 V- Q5 @ } 4 Q+ z& s9 d, g4 j S% k' M# c6 r: U
if (password<password1) + t! y8 W* `% M* Z/ G. z5 a0 `0 b+ q
{
# B& y% P- n/ D) I8 n/ | alert("重复密码与登陆密码不相同");
' v+ x2 B0 E1 r& s document.sform1.password.focus(); $ }/ }& ~% O$ `* ~( F2 t
document.sform1.password1.focus();
* D+ o7 ?% {1 b9 r( J* ` return false;5 d1 W# D6 y7 f! g
} ) F8 n6 z0 ~1 U$ y( ~. L2 K) t
if (document.sform1.email.value == "")
1 p( n t5 h. l& ~; Z { ( b M7 ]- S6 [; |+ Q
alert("请输入您的E-MAIL地址"); 8 h! H. x4 X4 [8 H1 T! O( L
document.sform1.email.focus(); ( D4 E3 w/ d, l
return false; - B& ^+ g6 `1 u% t2 n* ]) G" N
}
( L- h8 O0 W5 N% J( Q o ( R6 m6 e6 {% G, h
email=document.sform1.email.value;
$ x' m4 ?( W P! I emailerr=0 # G b: F4 b. e0 T* M
for (i=0; i<email.length; i++)
# \7 d4 P7 l& c4 t { ( q+ N* U" Y6 E
if ((email.charAt(i) == "@") & (email.length > 5))
& f" o% J6 ` s0 f" y Z3 P { * o, u0 p& N* k# T
emailerr=emailerr+1 4 c% J6 ^' _0 b B4 s2 K, S0 \
} ' b2 [" M5 s/ g; j7 n
} & f7 g# G4 \0 }: J3 q
if (emailerr != 1) 9 x/ _( @0 [* W4 d8 D( d; ^4 _
{
& w5 B6 R* P. }; O; M5 [0 S( j alert("请输入正确的E-MAIL地址"); 4 {" r* |' K' s" C; ^( D
document.sform1.email.focus();
) k h0 y0 F+ s |( c: @ return false; ' h. d' V Z$ g2 G
}
% u+ X& V& s8 T# ^ + I1 } p/ y9 }
if (document.sform1.checkask.value=="") 1 v9 o' i P' B1 m
{
9 t- s8 N, G! z* l1 C! q alert("密码提示问题不能为空"); . C- }2 K# x; J9 ~9 i( Z1 Y
document.sform1.checkask.focus();
: u3 T, Q+ S Z9 Z: q- \ return false;
4 ^* B" _" e, U }
) F' }4 d# b4 {5 v$ N if (document.sform1.checkans.value=="") 1 W9 _: A( [' @, @( {
{
, k# S" T" r) Q# H* k alert("您的密码提示问题答案不能为空");
9 f( k4 _( x! t V4 M1 | document.sform1.checkans.focus();
I- V( M# q b ?9 W return false;
; Z: w5 G! j8 C4 m& n. A3 s8 @4 ] }% [; r1 c$ i4 B" h
return true;
" c. n: {+ s$ s 1 t" U# c, z; J
} $ o: T8 A$ b/ `1 \/ g6 Z+ H- r& V; Y' ^
</script> |
|