|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
- C0 @% c6 X5 l9 A2 `2 @& A<script language="javascript">
5 @* S4 u M& l' nfunction IsDigit(cCheck) . c# r5 b! ?( ^# \( T M7 \
{ 4 ]) l* S" C6 L' c' K
return (('0'<=cCheck) && (cCheck<='9'));
$ W6 Q/ r# a1 S8 ]9 t& Z" r } 8 S1 @1 I% v+ u2 e' V; x3 }
4 ], l; W$ N# Z% p0 u4 ffunction IsAlpha(cCheck)
2 X% ?1 `( G/ E { 2 g8 X9 ^- q: b% L5 i5 V+ @
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) n6 E2 x7 q( |% M0 n
}
2 Y0 s% ^9 k% [" X- z0 i
* X9 _$ y! @) e/ F- efunction IsaNull(cCheck) % I( Q+ ^ @; `% @6 w8 N, q
{ " P' K; F% L6 E3 K) k8 l5 R
return(cCheck != " ") 8 p. w0 P4 e: b6 b1 p6 |$ t [ W
}
% z0 J4 D0 f; p6 M# b
' d- i7 T0 d# a; Hfunction checkform() 0 y6 T( t3 `; _7 L( B4 i
{ " E% K' C# d. ]- n+ \
id = document.sform1.id.value; ' u* o, q" Y6 X4 }% D4 F
if (id == "") ! r0 m! S3 T8 `. `
{ : Z/ q8 L0 U" _: L$ C4 g
alert("请输入注册名"); ' g2 u e. r- r; N: v( \
document.sform1.id.focus();
0 u2 b5 v( }. ~/ Z' l, J: M return false;
4 u; W( ?, M- n, I1 f# I } ; t+ o ^) ]7 b& ~" M# m& @
; K: @/ {# w, r- r+ Q/ f) \
for (nIndex=0; nIndex<id.length; nIndex++)
* O1 ]% n; i% S3 c' H, [ { B' }; O! v" t/ x. e; A
cCheck = id.charAt(nIndex); 0 g; S8 F3 C4 _( L* Q# O* G
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 9 Y/ G! ~; T) P. S: X
{
( o: W* i# ]3 m& g alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) h$ ]' S. \8 y+ ] document.sform1.id.focus();
1 m6 k; [8 P; Y4 D6 H return false;
6 g7 i- D% b% \* [2 b } % t/ {& b, ~3 w: M# ^/ K3 g9 s1 X
}
. L& P8 _, S" R1 ^ chineseid = document.sform1.chineseid.value; 7 A5 h3 m6 e% T6 {5 g1 E
if (chineseid == "") & E) @, s' _0 b0 D* ^$ r j' h
{
1 z& v }8 K: {/ v alert("请输入中文昵称");
; k% W2 y2 P1 U document.sform1.chineseid.focus();
9 K+ E5 e0 H+ r- J return false; - n$ Y4 G3 X, X, Z+ D
}
* M% e0 C9 `4 i4 u4 l- Z& ~ password = document.sform1.password.value; / s" Y% b/ ^$ R0 q; O2 K
if (password == "") 4 r' a. R9 G* n1 _3 E
{
9 L/ B/ e5 \" i) [ alert("请输入登陆密码");
0 Z4 R$ b& X b6 x8 u document.sform1.password.focus(); # j' y+ R# b0 A+ A6 g! K
return false; 3 d% F5 M) f, y C S" J- O
}
$ l4 F8 z7 K# k2 j) \+ h4 V password1 = document.sform1.password1.value;
7 c" Z9 ]; M1 V4 r8 K- X9 K if (password>password1) & Q) r+ s: K- D- N" y
{
, p/ B) I C% i) d9 U- @- Y: D1 F alert("重复密码与登陆密码不相同");
5 F U0 ~% g: g5 J6 d document.sform1.password.focus();
0 V) f* G, n8 Z3 U document.sform1.password1.focus();
$ L8 C. O: z5 @4 j) ?9 a& F return false;3 h" b( x; U; e1 j5 i
}
4 ]$ v+ A4 @) L. O! dif (password<password1)
6 N* R: c; ?1 x9 k {
% ?+ }- X0 g9 m; m/ c alert("重复密码与登陆密码不相同"); 9 Q2 m" v/ c! W' R5 ?
document.sform1.password.focus();
: V9 J5 V1 ?2 `8 D% }& A8 i document.sform1.password1.focus();
% `( J% B. _* X# w, j. K5 Q# G# [ return false;8 J6 J- K% b" q/ K; q! }" b
} - u9 T7 K) a+ U# ^
if (document.sform1.email.value == "")
" O( p( z; }$ Q% [& m {
G! e: J* E6 S7 L. Z) ~ alert("请输入您的E-MAIL地址"); ! [4 m, T* ?1 G& J& {
document.sform1.email.focus();
5 r) g7 g9 ^/ W) Z return false;
; Q, W. m% j. b# {) t } ( Z5 \6 X6 s; Q& u0 g) m
% q4 e% z: C* Y5 [& S) M; O; f" } email=document.sform1.email.value;
& a% }9 u7 X* J0 _ emailerr=0
3 z& Q1 [" r& a' _ z2 q for (i=0; i<email.length; i++)
0 j& C: l+ W! c$ [6 l# \7 x {
! I8 ~ E8 U% W( I, O0 D! M if ((email.charAt(i) == "@") & (email.length > 5)) 6 \# x6 M" D( s* t
{ 4 h3 L, ~# U' |" }8 T, `6 ?
emailerr=emailerr+1
1 c% C% } }/ v/ Z+ ~4 _% ^ z0 _ }
# L) c r; P# [+ c5 ~ } + D, v9 ^ }) @- C3 G
if (emailerr != 1)
; q5 w7 S0 A+ }9 R& E' w {
7 {& C0 v- [+ N% q alert("请输入正确的E-MAIL地址"); 8 ]! g2 S* @) n
document.sform1.email.focus();
& r9 M1 m& t6 W) j8 t: t2 r$ q# t return false; 2 _8 S4 G& |7 K
} ; C$ m3 u! a1 c6 j! b
, h- n6 C% O" g" W if (document.sform1.checkask.value=="")
$ Z3 G. e3 k# o9 y {
" G. |; K: I# F+ o$ x alert("密码提示问题不能为空"); 9 F! `: M! s. e, c2 Y# \ M
document.sform1.checkask.focus();
6 i( T+ H$ a4 G/ ]$ I( Q return false; - j/ ?+ i/ Q9 q5 z: L
} 6 {. D% ~' d4 [( l
if (document.sform1.checkans.value=="")
' g5 o1 v9 z( w6 Z { 3 e0 P$ r! l! |7 D" a9 Z
alert("您的密码提示问题答案不能为空"); ( \5 o: M, v, `0 J; x! A8 q
document.sform1.checkans.focus();
8 o- x5 I" g$ r) \ return false;
V6 q7 p0 _2 S0 F+ {' P- G }
b% y7 P1 c3 t return true; , V }% t! F( r. A* l
" c1 X- ?. x/ o} / B2 s. C( U. h! ]6 o6 [8 E3 b3 m
</script> |
|