|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:
# N5 H! w& Q# E6 i3 M8 t B<script language="javascript">
~" w8 _6 Z# t; c- |function IsDigit(cCheck) ' \1 X9 b6 |: f2 P* B
{ 3 W) X- T/ x# t5 ?. z8 d. W
return (('0'<=cCheck) && (cCheck<='9'));
0 d0 t: R6 ~& a4 w }
, Z* R# }/ F# L( ? 5 d8 t% Q1 `) e4 \: L
function IsAlpha(cCheck) ) G! D7 ]! z+ K9 B
{
6 v4 x9 X9 ?: x return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) - f9 _0 q# J3 A \+ }- A. p
}
# F% X" N4 ]& K" R2 Z' g" N9 G$ p' |
7 O' x: V; m7 [5 F i5 Qfunction IsaNull(cCheck) 9 w" o5 ?6 Y3 X
{
/ u: f- w: u! S1 { return(cCheck != " ")
* z) h1 s8 G" m& b8 U1 A3 b }
8 f7 h. G* ~& N" U % d m9 d. w# b: h
function checkform()
: z0 u9 L+ U; l5 k; l; C5 n{ + b, d/ i. j! D `
id = document.sform1.id.value;
4 {% q/ m1 K/ j* j6 t" S9 i p if (id == "") 1 Y: N$ f# B) L$ J
{ & W- S/ R9 I5 `% o3 y
alert("请输入注册名");
- i O: I" x7 q9 Y. r document.sform1.id.focus();
" W2 z' B4 J$ O. o5 F3 d return false; 5 U0 L# W: }0 v, v5 k
} 9 E9 L2 y! i" v
$ ]/ ~, b1 m% o& A: ^4 @/ N; Y for (nIndex=0; nIndex<id.length; nIndex++)
% Z& M1 Q- e9 L! }) ?6 w! y/ | { . h8 g4 ]: v8 C/ n3 X8 T
cCheck = id.charAt(nIndex); $ v% u4 X% E& `6 ?. v8 V
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) y; H) R+ [0 l# o2 c- Y
{ - q+ G ]( C7 v3 e( |
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
! ?/ Q/ r& W( @: L+ d& r document.sform1.id.focus();
1 _7 Z, D; S9 O) ]9 Z return false; . V7 S- ~2 V6 M
}
1 Y6 c E0 U$ M }
& v# [+ k0 o* p) d" V chineseid = document.sform1.chineseid.value; 5 p$ f" P4 X' q3 F3 X
if (chineseid == "")
) P( N/ L% t y: c1 Z+ h+ Z { " d* ]: P* r, Y
alert("请输入中文昵称"); + `$ L& T7 C8 v" O* _
document.sform1.chineseid.focus(); 6 X2 C/ H3 E7 i: t. t
return false; ) D- B+ ]% b& R% J9 z- x
} 5 l, Y* ?- I. Q# e% S
password = document.sform1.password.value; 2 B [6 x0 F6 ]/ }
if (password == "")
8 t! [/ e2 P4 H- w2 T/ e { Y7 s8 a7 I6 V0 i* c7 l5 s- Z" |: l
alert("请输入登陆密码"); ' W0 Q5 m4 S0 d* m" l
document.sform1.password.focus();
; L6 H3 W2 v$ p+ d return false; # n! G1 c/ \0 W1 m4 ~( Z2 e
} 1 d, L; h" P, L* z- I D. ?
password1 = document.sform1.password1.value; 8 X1 A5 {( l* {# C$ `
if (password>password1) _" h$ i4 m2 L0 h
{
( ^2 e; |/ v& E alert("重复密码与登陆密码不相同");
4 s% k- N4 t- a5 n. M- D* p- B document.sform1.password.focus(); 8 I" r. K; y& b1 D; L3 h
document.sform1.password1.focus(); # l8 T5 Y" \/ x6 n$ ]% f% c Y$ ]( m
return false;
) w' J( b) p l7 Z6 R! v) b0 r0 K1 Y }
/ Y. Q3 |: l( ]! G+ [4 a- |$ o% c sif (password<password1)
7 H) \$ L/ V5 z/ g& |1 e& p# i {
6 u- g5 y V' i" a alert("重复密码与登陆密码不相同");
" @ g, w4 @( x. S& _# w document.sform1.password.focus(); & \" E" {( Q" Q$ A3 g4 O% V! z
document.sform1.password1.focus();
( [, ~$ r+ u7 d9 b! { return false;" v/ S9 q1 {. g5 r# b/ v. k) Z) |7 X0 u
}
8 I. u. c/ V- k if (document.sform1.email.value == "")
5 j1 X1 l+ G& p2 C {
: o" h- t- Z+ P: R- e' h alert("请输入您的E-MAIL地址");
a, o5 p8 }3 ? v; ]$ B0 g4 H document.sform1.email.focus();
$ S' C; h* I, ?2 R return false; y$ y; L: C* v2 M4 R0 X
} 4 j" `# Z1 E- C. U- k4 B; z
+ J/ h: Q" K3 ]$ [# W4 Z$ I email=document.sform1.email.value; ; A, \+ P' F# r, U) N
emailerr=0 l5 P( C _+ D; u; g
for (i=0; i<email.length; i++)
9 @0 R; i( u: {7 A3 ] { ( C. @, F. C5 V6 w: T. {2 P
if ((email.charAt(i) == "@") & (email.length > 5)) 9 a0 A+ d! J) `' F6 [) H- V
{
$ }" i4 Y2 F) O/ D; ^& w# ?) F& ^ emailerr=emailerr+1 % F# R! o: n; W
}
5 L1 C6 F1 ^( x6 B" t } * `$ u0 P# t. X, i
if (emailerr != 1)
( D' C; \& Q3 a. L# ?% R { 0 [, E" e( F2 x* t/ U. m
alert("请输入正确的E-MAIL地址");
- q) T( W; k; ~) \& A Y document.sform1.email.focus();
u( i$ l) \1 y* g: q9 m8 F% ` return false; 6 R: P6 K+ |7 {" I# j
} ! P' l) o: A& M5 Q
/ O0 H3 _0 c) \, N0 }
if (document.sform1.checkask.value=="")
, l& t& i- J2 A% O5 J) N& p { ; \9 G% J0 y1 `
alert("密码提示问题不能为空");
+ q; _% P1 P+ u* D/ R; | document.sform1.checkask.focus(); 8 r3 t% P/ f6 d$ k6 W* b4 [% J
return false; - ~4 c t& M* K5 f( x
} ! w2 r3 C; {/ ?* x4 i
if (document.sform1.checkans.value=="") , l; U. D! j# w
{ ( }; Y5 ~" |$ C* Y4 L
alert("您的密码提示问题答案不能为空");
7 D* }' w" f8 c! a" ]+ J document.sform1.checkans.focus();
b+ k' X( E) Q* d) V$ _ return false;
" A7 ]* c. R7 }/ c: z( t9 m }
# \: s& b' k* V5 ] return true; , h$ k9 Q, U' ~5 [' D, l+ H- l8 F
) w- {7 I9 p5 l% E}
. A( X$ M5 l4 _1 c) W5 A</script> |
|