  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
这个脚本对你可能有帮助:2 ~: K* [+ y4 W# Y1 `
<script language="javascript"> ' P/ u0 U8 W8 |
function IsDigit(cCheck)
1 m0 U1 Q1 H2 |$ g- V8 [0 Q6 c { # Y# I" B& ?: Z6 Y) L+ R1 u2 x2 Q
return (('0'<=cCheck) && (cCheck<='9')); / |" M5 f& X6 w' `5 N
}
4 n9 z1 V6 z/ O
% r* ?* a! @, H, T3 y& Vfunction IsAlpha(cCheck)
: ]9 l, I, @2 d {
& o/ b) z1 I6 u' l6 D0 t" t1 F return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" F% T W+ k; \2 J } ' X& b' r$ @ \( ^3 a K
* u1 Z' F' {! |4 k+ `! F% P! ?
function IsaNull(cCheck)
) V, S1 Z: y6 c2 v& z Q9 ^& m4 f {
% r. Z9 n \- P7 F return(cCheck != " ")
! r x0 ?( [, ` }
$ E- K0 x* v+ `" _$ } / L4 G# F, i- m* y. ]
function checkform()
5 d; g/ W3 u; S{
6 \5 A/ }% w; C. l) U+ \ id = document.sform1.id.value; 5 o* ^2 m/ r; V& T- V$ l
if (id == "")
( {" K9 c% V2 k5 |* U, x {
# {8 c+ y, {4 R& s- r/ _5 t2 {3 q alert("请输入注册名");
) r. S* s3 R! H, v+ |! O: B" `, W document.sform1.id.focus();
# O; U1 r7 y$ p) f return false; 5 U) y. g. i3 }& z `
} 7 w9 Y) i o4 Z+ S: h
* ^- A/ Z* P4 L2 L+ s
for (nIndex=0; nIndex<id.length; nIndex++)
8 x/ ]. w9 Q) F: d { * ]7 V- k: h o7 P( q% M; p h4 ?
cCheck = id.charAt(nIndex); 5 k! R0 s. K8 Z- G& ~/ x' j9 j
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
5 [% w. D5 |8 b% _$ `4 w {
9 f$ V8 ~; {! [$ x' I! P alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 7 R. n* f/ ~; G$ m" p6 L
document.sform1.id.focus();
* P; L6 S! F0 o: u; c5 ]' h4 j return false;
0 \# f; c9 C# n+ ^' _8 _/ R3 f } 9 ~- a+ ~" n. E+ W4 u1 H3 X
} ) v1 n# J3 V8 Y! w; h, o
chineseid = document.sform1.chineseid.value;
+ _: n" m; e% n0 U0 |9 Y% w8 x+ X if (chineseid == "") 7 U- x# y' Q) f8 @ j
{
8 ]1 ^! V! k7 ^* t [8 Q! o+ u; \7 M alert("请输入中文昵称"); ( P7 x% k1 q( O* I
document.sform1.chineseid.focus(); ) p. i# @" M3 w0 b
return false;
2 ?5 b% w; M' e' T, g4 p# R }
6 r! z% z2 g! Y% ]5 z& \. v password = document.sform1.password.value; ! h! _2 T" k2 n! E6 p" p( W
if (password == "")
9 D# }0 R8 [/ Y: q { 9 z- a* }& A; b& w- n, j
alert("请输入登陆密码"); 8 K3 d. d8 h# A& [* A
document.sform1.password.focus();
0 |2 e; M" @. M8 P( Z return false; U* r" W9 M V; k: ^; e
} & X5 n( b" Z( i2 V- W5 L& _
password1 = document.sform1.password1.value; 8 B$ m2 o y0 j, j
if (password>password1)
7 \7 A! d- `/ O0 B3 l) x. f" P3 B$ m {0 n+ }* c8 U/ Y7 ^# G8 p
alert("重复密码与登陆密码不相同"); - E& \) g8 |9 J3 w
document.sform1.password.focus(); 5 [1 `4 T. z6 m5 b6 _* O- u
document.sform1.password1.focus();
( I+ A8 Y5 r# j- a( E! ^2 B5 t return false;9 i5 c1 m: Y# E! R. H
} 4 Y9 }$ D" _" q
if (password<password1) ' Q. [- c/ h" z" `
{
: t. \& |( Y; S. B alert("重复密码与登陆密码不相同"); 8 ^+ i) y: p9 |' ?* i
document.sform1.password.focus();
. i# h0 l3 Z) V( K! s: P; r document.sform1.password1.focus();
: n! q7 W' \8 A: N6 ` return false;
2 C) o& @7 h" `1 V% a+ u$ L } 7 i6 A9 b& r& t2 s2 ~3 l
if (document.sform1.email.value == "")
" B; Z6 B& V; [1 K# G9 r {
' n" R. J6 u8 Z: H0 X alert("请输入您的E-MAIL地址"); / k: A. B! |8 G
document.sform1.email.focus(); & t1 {# _) \8 O+ F, l
return false;
8 H# m/ T" J1 _. `. `" f } ) ~; [+ I8 A @: ~, ^% M
4 u8 M0 {: F4 S. L3 { y7 F
email=document.sform1.email.value;
2 j+ _8 B% W A1 U5 {; U emailerr=0
( v- O6 C0 [: Z; B8 D for (i=0; i<email.length; i++)
% K* |1 E2 l$ a5 K V {
! Q/ `9 q+ u4 r5 k! A0 e8 ]# [ if ((email.charAt(i) == "@") & (email.length > 5))
, D0 D$ `( A! h { . Z9 T! r ~6 \' {7 o
emailerr=emailerr+1 6 N) ]; i5 J9 A S' k
}
7 x# k- P: W9 u3 `/ }% y$ D }
: j4 `# C8 i# m, Y& ] if (emailerr != 1) , |0 E; ?0 f/ H) g1 C- [ Z
{
5 z, k3 {. J3 b% {* r7 H alert("请输入正确的E-MAIL地址"); 7 q, S, {$ M) q" H9 m
document.sform1.email.focus();
- G2 s- m7 ~( a' B' A: M: Y* N return false;
3 h; @5 |' p1 D* K4 \ }
7 `! i% ?7 [3 O$ u6 Y3 D . f4 ^6 @; ^8 W9 e( M6 W9 H
if (document.sform1.checkask.value=="") ) @! ^9 H# R$ W# E5 e# }: @
{
$ X8 M) N5 L( y q5 L5 ~9 \* D& c alert("密码提示问题不能为空"); 7 N+ d6 t) n7 d. X
document.sform1.checkask.focus();
( W7 w& z9 D1 H2 Z. V9 f. A return false; # s' W% ~* o: ^
} % K8 {0 k! C2 j9 c$ g+ n
if (document.sform1.checkans.value=="")
( ~; x- o0 a. R2 c2 m {
9 N0 { s! X( M4 w alert("您的密码提示问题答案不能为空"); & z6 b) [! g2 x4 o( A4 E
document.sform1.checkans.focus(); 2 i6 Z. ~/ B5 ^2 F5 ?2 _
return false;
5 q0 |# a+ }3 F }
) F& D8 N" o1 G8 Q6 h7 E return true;
2 d6 R4 S( ~) P9 }* J" i
4 a$ }; [0 I& \% S8 o}
8 V7 j2 M5 P& B- k1 X3 y</script> |
|