|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:, w/ A$ `) l9 r. J
<script language="javascript">
4 j" C" p. R8 J( O2 q, L6 j6 mfunction IsDigit(cCheck)
& O, h8 k" A* C9 r b {
" x6 N1 l! K. _2 M5 i0 t- q% G return (('0'<=cCheck) && (cCheck<='9'));
% `* A* y+ p [: O( ]9 i { }
' L0 D3 o1 [8 R5 a+ C; V4 P$ P" c' o
7 P+ Y- O! D; w8 bfunction IsAlpha(cCheck) . X; B6 s' {$ a2 q/ h
{ p% Z9 y$ z% @2 q, Q/ e) C
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 5 s/ a. A% h2 }' v5 A& c1 r5 ~
}
: R& R' e/ P) ?* X$ G6 K ^1 W( o2 }0 x ) Y" }$ P; O7 T
function IsaNull(cCheck) 9 d1 A- F& \0 `$ m- N( H; [$ t
{
2 Y$ l) m, P8 k( t return(cCheck != " ") " B8 T2 |9 O7 V7 S$ d
}
6 G) s" U8 Z( L
* _) @$ b; o/ } ^, rfunction checkform() " \3 Q! M% }8 @# L9 Z
{ % h h# |+ `* h6 w+ K$ d5 o% z
id = document.sform1.id.value; * F9 V9 A' K3 p0 Z
if (id == "")
" D1 H/ n) B7 [) j4 @# i; Z) K { " U+ l& _' J" _: S0 \7 o
alert("请输入注册名"); ' o. r# b& P) c& s8 n
document.sform1.id.focus(); , m7 A! @9 r' m- y+ \$ K4 c' m8 U, [
return false;
* H' H% J6 t7 { }
; M! @4 j0 F6 q7 s3 V4 M% V * S/ R& K0 X0 |3 G# j& N# E% ]
for (nIndex=0; nIndex<id.length; nIndex++) 7 `. e8 ~( I( M7 R5 l
{ 3 o" y" V0 L, C, @" `
cCheck = id.charAt(nIndex);
; F* L' W- e J( T7 x if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
" G, B/ _8 a5 q! S9 k { , a$ g' S5 @) Y' {' s, g3 B7 {
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ) V- c* f. L( F- `* Y! C
document.sform1.id.focus(); # y! I+ w* ]5 G6 f" P; D, S7 ~
return false;
. d X' o5 v( P9 h! c } 7 B1 a) m3 h- W' n u# a7 _
} - x* v! T( @" ~* K
chineseid = document.sform1.chineseid.value;
1 D3 q2 q, m; ]/ s6 q& G b* { if (chineseid == "") & R* k R% X( ~ `. M
{
3 O7 M% K1 q# n: a5 w alert("请输入中文昵称"); & B; l2 G$ h+ m: i+ h. N
document.sform1.chineseid.focus(); 1 r4 J, n' O6 U7 P6 A8 ~
return false;
# ]: G1 b8 c6 o }
1 `( w6 X5 B# v5 F password = document.sform1.password.value;
* d1 C1 F- `1 O. H9 e# S/ q if (password == "") 9 ~9 i2 g [/ E8 D
{ 0 ?) D2 c. F$ Z9 f2 T
alert("请输入登陆密码"); # ]9 {1 s( U3 }
document.sform1.password.focus(); : I2 d: |7 I8 n* s/ t' O" t$ o
return false;
+ f d l c* m } . r+ F# V8 L8 |2 `
password1 = document.sform1.password1.value; + e7 G' {% w e4 {
if (password>password1)
+ }/ a# `, b6 ?8 _ {
5 f; V6 ?# ~' E6 j# S0 {& t* B alert("重复密码与登陆密码不相同"); % U/ G/ P) h4 \* x3 r7 U$ s
document.sform1.password.focus();
% P0 T( _0 u4 O) ^: k1 {' ?$ B; r7 a document.sform1.password1.focus();
4 D' m% C' ?0 c' [2 \9 N; M7 T4 S return false;
0 D4 {' Z5 i& l9 S8 `0 ]' e, I1 c } , @" V4 a$ h. D4 L" U O- l. \6 H
if (password<password1) " I, y8 U8 b6 U L/ m
{) a4 k/ i6 y! a" P$ z, t
alert("重复密码与登陆密码不相同");
; Q; y# U; I; Y document.sform1.password.focus();
" h! |% y( n0 | document.sform1.password1.focus();
. t6 Z- }) N8 o, L return false;
" e' U% S; Q; N9 S( U- z4 F }
" Q4 N2 W( h4 C R5 W$ a if (document.sform1.email.value == "")
9 @/ P' n. o, Z3 a6 ` {
) ]+ N' E& t$ i1 G2 t alert("请输入您的E-MAIL地址");
9 `- }: n0 d$ J, Z/ Q! @/ e document.sform1.email.focus(); ( r \% h* O4 ]) w6 H) J, h
return false;
; P+ {6 y: R2 k X } ' T1 E+ K* h# ]+ f
" V" O7 w; ?) h0 v: V email=document.sform1.email.value;
& v1 x) ^, N \8 C emailerr=0 2 s8 r% |% q8 L$ |% m( G
for (i=0; i<email.length; i++) ! c! i2 ?, X/ Z/ Q6 Q$ d
{ ; L8 Z( Y, v6 {# a4 E
if ((email.charAt(i) == "@") & (email.length > 5))
9 i! b. f$ ~4 l C {
+ K) m; ^1 o7 C# x7 m/ S emailerr=emailerr+1 # R5 l( a; r0 m& P; x% ~- y
} ) X q: i& ]5 F
} . I/ b/ ?! g+ X8 J
if (emailerr != 1)
) ~7 z: l; o2 X% A8 } {
' \* y* }1 L! C4 p5 ~6 d alert("请输入正确的E-MAIL地址");
* A3 H2 Y8 A. ^ document.sform1.email.focus();
8 Y. P% r/ s( B: j, s return false; ! i( N, q% G u4 j3 X
}
' Q/ H3 m# n! t ( s0 ?& z% e, s7 F8 z- }
if (document.sform1.checkask.value=="") ! I9 \' A2 o! M( c, w5 d
{ , T, R0 p. V- I' P: k
alert("密码提示问题不能为空"); + u1 U- N: q8 W+ C% M, R# F3 O. m
document.sform1.checkask.focus();
1 K5 P4 m% f/ X6 J* R7 N/ I6 f2 F return false; 9 G5 E: l/ [" X# z2 O( q
}
3 e* R* l- @0 x if (document.sform1.checkans.value=="") 1 @' x; Q$ q5 {6 {
{ ; K0 R$ D6 Z! r- y- ]
alert("您的密码提示问题答案不能为空");
2 o, q" W* M1 s/ q! C* l document.sform1.checkans.focus(); 5 [) f2 f! U) V* p$ ~5 M
return false;
- f$ U! G* A! y- Y: R9 ]+ G; @ }3 O" q6 g, x7 Q; @( y* k0 H
return true;
$ o/ @& _# f- C 9 C1 x5 l( u5 Q, n" W* M
}
* F4 e$ a+ r' `. r</script> |
|