  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14161
- 金币
- 2371
- 威望
- 1647
- 贡献
- 1319
|
这个脚本对你可能有帮助:' i7 ~$ Y# _! G) c
<script language="javascript">
y) D% L4 a# S* f5 U# c; B7 D& afunction IsDigit(cCheck) 4 `6 M: ]% K9 r0 |
{ 2 x( d$ V& _, W9 p2 j+ G J
return (('0'<=cCheck) && (cCheck<='9'));
" u$ P" A* H( F2 Q5 m5 a } / \% W# U# w( u2 [
* H) s. d7 c, d. Sfunction IsAlpha(cCheck)
& @% ?$ l0 V4 b# p { 8 Y# d. j" v6 E7 T" \
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 8 d" b2 _7 G v3 g
}
e- g% d f# ]5 m
! c" z: R( R& Y' r- X: g( m7 {7 dfunction IsaNull(cCheck)
* }' l0 ?9 _ W+ j { 7 K3 H" L7 ~, s- U
return(cCheck != " ") ) V: t+ u0 ~9 z. K+ ~
} % e. D% W- H/ C2 r1 ]
) y. n: e$ t" m" Z4 `
function checkform() 2 o @' ~7 K8 E& X& S; X- t2 `( y
{
0 W1 w8 \6 }8 P* z id = document.sform1.id.value;
) _) U$ Y5 z l1 d1 i+ Y# W- K if (id == "")
0 y& \! M0 }! Z# P- }: M { 3 ?, }. z) D: }
alert("请输入注册名");
5 U/ j* P+ b4 u- T% Z& `; \+ H document.sform1.id.focus();
3 a/ M/ ]) Y+ U! D; f7 K/ n return false;
i0 n4 j9 K$ c4 r* ^ } ; ?* H( G2 n+ J# s& Y6 T' e
, R! C& b8 c- g0 f; x
for (nIndex=0; nIndex<id.length; nIndex++)
8 x7 A; q/ o5 X! ]4 d/ | { # i3 s# R% z; Z7 G4 V8 u& n
cCheck = id.charAt(nIndex); - H/ b- k+ f( K* U2 Q' \* d* R* \
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) " w; m- v) s6 _: A$ M# k
{
@: h7 @6 s- g alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' N! N1 L/ K: o# ^ document.sform1.id.focus();
& r$ r# N0 O7 j+ G% Q9 i return false;
! }5 U) s% q6 D9 P5 C0 `. d2 } }
4 z Y2 w# u9 `; b }
9 j1 l& n6 B* \' z/ l, S6 f+ {5 C chineseid = document.sform1.chineseid.value; / R6 h4 c3 @: E' M- F
if (chineseid == "") # H* w' f$ ]5 B/ V1 l9 V" ~
{
- i) z+ _" y4 @9 j; N8 X- ` alert("请输入中文昵称"); 0 I$ I0 R B6 w0 Z
document.sform1.chineseid.focus(); 6 ]" A# _ c! N2 o5 f: C
return false; * l: f0 m8 `; k- _9 x
} ) u, j9 L1 p4 o5 X* d* F$ Z9 q4 q/ C
password = document.sform1.password.value; 7 \3 q' _/ _' U4 C2 l# ]
if (password == "")
9 A. K$ ]3 u2 w* d4 I9 @ {
% b) H& z) h3 f+ B; `8 c alert("请输入登陆密码");
$ b+ Q9 _5 v2 ^% P document.sform1.password.focus();
, ^- K) a+ J8 F3 z% g; p) \ O return false;
% P4 j9 L; f4 a" c* m }
, v/ [0 `" p) Z& C password1 = document.sform1.password1.value; 0 v! Q- @, L4 {3 u; g) L
if (password>password1)
# \/ m+ d3 Z0 s: I {
. U7 n( K) G4 ?" J$ n1 d( N7 H9 H alert("重复密码与登陆密码不相同");
, J ^) X9 X1 n% [$ x; A, h' n document.sform1.password.focus();
1 U+ `3 D! ]2 t+ ?* g) L2 ^. c document.sform1.password1.focus();
# R. M! q, l* d5 Y' m% X. N return false;
5 y- l0 \8 @$ Y; z8 E W! q) p% I } , R( T$ L2 H; G$ J6 x2 C$ Q4 f/ a i
if (password<password1) " S& k+ E6 p1 L, R* r
{
g7 B1 d% S; Z% _ alert("重复密码与登陆密码不相同"); # u, Q' Y) W% e" ]' k
document.sform1.password.focus(); 9 c* r6 S" @7 l1 e j
document.sform1.password1.focus(); 7 k4 W& y: Q% d# ?( a: M; ?6 Y
return false;/ L8 i" c! \! E7 W: Z* D
} ( ^5 [8 S- w9 o2 y z9 [
if (document.sform1.email.value == "") 0 o" h; O, B2 i' ?- E
{
/ C5 Q% W/ @: _ alert("请输入您的E-MAIL地址");
. g: d3 @9 f. ]3 Q document.sform1.email.focus(); ; m$ C0 g9 y( z9 f3 s
return false;
: W1 y% f0 K$ C5 `8 l' \' Y } # E- ?) x& I( B8 N2 w" F. z
/ ]! k. H8 ]' G' U email=document.sform1.email.value;
6 g$ |5 B1 A2 O; C6 E emailerr=0
$ D4 d! y% p7 b: A5 ~ for (i=0; i<email.length; i++) 8 O3 ^! O2 w2 w/ y( q% l
{
' |8 Y7 Z9 y/ q4 `3 W if ((email.charAt(i) == "@") & (email.length > 5))
. m8 \# z# Y) Q, Y V; C8 D { , ]4 L6 K7 `6 M4 B6 U3 s
emailerr=emailerr+1
4 z7 }# x" b7 F8 @& r% O! P } ! o5 b2 L/ F( Y' o$ k% s
}
/ h K) V$ l; W* m5 Z8 y3 s if (emailerr != 1)
9 E. o$ f- F& X' D/ X* Q- a { - `4 D. ^$ Q2 f3 @
alert("请输入正确的E-MAIL地址");
- A! B k2 s; L3 ^4 A document.sform1.email.focus(); . _% M, d0 Q- r. l+ T6 C) a! C/ ^( H
return false; 6 Z- i: ~: k1 x) ~
}
9 H% H3 c5 _ q5 T9 |; J' Y/ g8 H( [
9 H2 l* w: S3 e: o2 K if (document.sform1.checkask.value=="") 7 G; l- t+ O5 {
{ 1 d9 R2 q! L! [" v. F
alert("密码提示问题不能为空"); + a* @- a% L" p' H, I+ t
document.sform1.checkask.focus(); + H7 l {& B0 W$ g
return false;
6 a$ X& W; B4 x! `( R6 `( `7 V }
6 Y# p$ ]9 X9 L+ ? if (document.sform1.checkans.value=="") + t+ N. J0 E2 L: d, j
{ * T2 V& h1 C2 }
alert("您的密码提示问题答案不能为空");
! y3 d/ D; v* r! I4 P8 {# c. j, H; N document.sform1.checkans.focus(); 0 `/ x" W2 h- p
return false;
G3 M4 {: W7 T+ ~ }
( C' P8 e/ q" f7 I% U: D* @ return true;
7 W. g: \) `- N" y+ p0 I7 s1 ? . Q w6 W' I2 {( v% C/ @# e5 y3 |
} ( ]' g/ b. C+ F
</script> |
|