|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14371
- 金币
- 2471
- 威望
- 1647
- 贡献
- 1419
|
这个脚本对你可能有帮助:
& K- Y; w0 S: E9 A3 k<script language="javascript"> - i* \ o/ w# H' v
function IsDigit(cCheck)
! f7 `% O; r% Y b6 F$ F: _ { : H1 ]4 m# r$ k9 \: E
return (('0'<=cCheck) && (cCheck<='9')); 0 _( @- ^6 H) I3 N7 G
} # S" U, ?1 |% ?# {2 m; a! M& w0 g
9 l$ n) Y+ K- D5 Q, sfunction IsAlpha(cCheck) 7 n& d! D7 e, V' h+ \* [, f2 l
{ 3 X' n) E; x# X0 ^( z7 [
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ) M5 Z0 J1 J" V# i: x1 e
}
! F7 F8 e1 @1 I: m- d
+ U# w! S" |# M, Yfunction IsaNull(cCheck)
0 {" b3 Z( X1 V* {/ R5 m { % K' t/ k) V9 g0 O* a: f3 `; E$ Z
return(cCheck != " ")
& Z9 p# O; F I& \! x }
- x7 G5 `. J3 J7 B$ D# u8 H % \- k; {" P' o( ?% s6 |7 n3 Q
function checkform() 8 C5 X- v# `3 S! h! p1 W, P4 g: @% a
{ 1 M9 a. O. B' A# N9 x5 O2 q a: m
id = document.sform1.id.value;
# h$ T) f6 b3 N% q' U if (id == "")
4 ~& {9 \$ U S6 n {
2 M$ Z! g; E' t2 p( [, l alert("请输入注册名"); ; p3 ]8 T: N4 N: A
document.sform1.id.focus(); & g9 l, n2 w7 v: S' |
return false; $ Y3 ^ G6 T( |) |; l
} + I4 N" }% l+ O
+ Q, Q7 a E( v0 p1 n
for (nIndex=0; nIndex<id.length; nIndex++) " G) X- o! H& }1 ^% J, t3 w
{
- d- j: }. z2 d' q; A% u' g( o2 L cCheck = id.charAt(nIndex);
* H: E4 A& @ p: A- n9 b2 L# v/ R% w if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 1 X- {5 l, s) ~0 d+ E
{ / q# o) ?( j+ z* P3 S
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); / f) I% K5 W$ u2 w# J& w7 g7 [- h$ [* f
document.sform1.id.focus();
6 N8 j; o+ K1 P; _ return false; - @! ~) {/ N& [0 k s
} 5 Z' ^2 p- x" W0 c% X% m* T
} . {8 X; z% l9 _; t
chineseid = document.sform1.chineseid.value;
( ?; P% q+ | _0 T) i if (chineseid == "")
4 k( C1 V R7 r. l. B { 4 y' q+ M- z# u5 [# I( d0 G
alert("请输入中文昵称");
3 N- M4 U0 s4 x% R. f: ^' C5 M document.sform1.chineseid.focus(); & f: n: r* K4 w4 w1 G+ _0 l# q3 p
return false;
- y, c0 Q4 U) ^4 x }
Z, e5 M0 B w* r: Z) l4 a9 q password = document.sform1.password.value; 3 Z/ S3 q; u9 G# k
if (password == "") * L3 I' t6 Z! I3 Z
{
7 l8 ?- r+ |5 _9 z \, x: ~ alert("请输入登陆密码"); + E* v$ S1 L' W+ @( q
document.sform1.password.focus();
" S* ~5 |2 T0 B T1 Z( a: O) b return false;
/ n6 D: ?( ~: s" \# k/ ] } 7 e4 O" D3 e( H4 I! m- Q
password1 = document.sform1.password1.value;
) N' g+ s3 ]0 X9 Z8 F) n if (password>password1)
, _) u8 k/ {1 R6 m) T {, R' E8 t: ~) ?; L8 h% t% W
alert("重复密码与登陆密码不相同"); - K& G& w* t- f' j- F$ |1 B
document.sform1.password.focus();
9 E7 H5 o, N7 G! Z2 x( N6 s2 o0 E document.sform1.password1.focus();
' n1 d2 M9 a; j; ]' O6 h) A return false;& _* m) }0 @$ k' [
} % A) c& y( o2 J R+ \
if (password<password1)
& o/ H$ S' h2 W: y {& h; G( I) o6 O% E O& ]
alert("重复密码与登陆密码不相同"); % S6 P7 L7 E- K5 `( j Q. E
document.sform1.password.focus(); 5 m& W O. O4 n8 Z2 b5 c
document.sform1.password1.focus(); 2 k9 |) Z2 p' v' h
return false;# U0 b. m" v. Z. |6 ^4 m
} - ?6 ~- R: h4 h5 [9 P
if (document.sform1.email.value == "") / d& M, n& N, x& x& q/ t5 c$ S
{ ! }0 L9 m) J9 }8 m' G
alert("请输入您的E-MAIL地址");
( E S4 z& d& S% L; s document.sform1.email.focus();
% X0 u3 O4 t4 I2 O+ u return false;
2 p( S; ]$ _# ~ z' o! z* j }
' ]' x$ D d0 w& b; V
+ `9 k, {; X1 }2 q email=document.sform1.email.value; # Z* X" V" x( H+ V$ k9 }
emailerr=0 / \: |2 X; Y! i
for (i=0; i<email.length; i++)
% v+ i7 w% W" F! U$ V: Z3 C- V { ! b5 _2 g9 A) v$ L+ o
if ((email.charAt(i) == "@") & (email.length > 5)) 5 r8 P! c" p) N6 m5 C$ E; k
{
* \ [( [# D5 T5 k9 v* C emailerr=emailerr+1 & p' z1 }( d2 x8 J
} ; J8 o- K5 Z: K! T) A5 Q7 C
} - {$ h7 [% w2 P
if (emailerr != 1)
) l) F3 w( g/ T {
0 n: i' h8 Z5 O% `) z1 Y8 H alert("请输入正确的E-MAIL地址"); , ^0 S! _9 G. f8 k
document.sform1.email.focus();
; P) m0 B# a b+ m m4 B: c return false; ' Z( f9 i6 k3 i5 p0 k
}
: ?8 |+ `" g) g7 p" g' ]9 w3 `
3 \8 S% t2 F9 ?% b6 F: h6 |: J if (document.sform1.checkask.value=="") " n7 K& C& x% e6 ^4 W0 w
{ ) K6 t6 J9 E7 |- x
alert("密码提示问题不能为空");
3 q8 d. L2 \, M3 J9 N document.sform1.checkask.focus(); - b m, O$ d& p% Y. t7 M
return false; ( n4 \/ l# {* w
} % E- p6 ~ Q6 l* T, |
if (document.sform1.checkans.value=="")
& M3 G) g. i6 B8 s) v1 `6 G! O {
6 L4 w5 X2 c1 r; S6 }5 R alert("您的密码提示问题答案不能为空"); + F6 [8 P! x4 S9 h9 M- o
document.sform1.checkans.focus(); 7 Y7 j R7 i& }
return false; ( X) r* u: Y" a2 W R! [
}( a# l% O% a1 W2 B) D8 l6 h
return true;
# x6 S( w, ?$ ] 0 g+ p+ N9 B7 A! g4 m, x
}
; z( ]" E3 Z1 e. {</script> |
|