|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14331
- 金币
- 2451
- 威望
- 1647
- 贡献
- 1399
|
这个脚本对你可能有帮助:/ @- ^( \* P, h
<script language="javascript">
: J: H( X$ A, W3 u, a) pfunction IsDigit(cCheck) : x( b( ^ o2 @, |& F# _. S! ^
{ ! W/ X" m9 Q1 R4 j4 T- U9 A
return (('0'<=cCheck) && (cCheck<='9'));
& D! g: G0 J g } ' F7 a$ L! A& T9 Q* N. k
9 L" |- ]8 _( ~
function IsAlpha(cCheck) 9 z# O: [1 R- U( m" x% s" c: V: Y
{ 6 Q+ v/ u0 b" D$ F3 n
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ! y+ m x( _# T3 g
} : @; x& G' Z: R0 `! f
' w# u4 q4 \3 d+ k. q) h4 f
function IsaNull(cCheck)
1 l, [" j7 C5 s, S {
( w' z$ |8 _1 W) _' e return(cCheck != " ") * h' [. M: `4 h- B4 H0 Z4 Q
} ) ]. K* W& J+ P9 ~5 @' B
) @; d' t* X: L3 ]function checkform() / P. V( Z2 C( d
{
m8 `- R' ~3 g" _; |9 ~( I: ]) [- Z/ U id = document.sform1.id.value; , Z G$ g; L2 \0 h: \; R
if (id == "")
. R& @& E- `' l% n. V% v2 [0 I2 h { : K5 _3 a( m0 {3 {+ b
alert("请输入注册名");
5 H! O0 h) s9 u. ~ document.sform1.id.focus();
( O! a2 ~7 \0 J/ _( ^! @ return false; 2 x) c; g' l) G; ?
}
# O" J9 `2 ?' `1 \* o& C ! v- b- a5 y- z9 @7 D4 B4 D
for (nIndex=0; nIndex<id.length; nIndex++) " q G; `) W4 ]# J y2 D7 x
{
) u8 V2 g/ I* a7 N, ]! n5 a cCheck = id.charAt(nIndex); + b5 ]8 h2 F. Q$ \
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
6 }+ f, [* S. [# i- ~/ f7 V) x- H {
8 z& {% C$ t3 D7 F+ ^ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
. J0 ~ ~" w2 g document.sform1.id.focus();
|4 [2 i5 d& t0 L return false; 4 ^* E9 f- t8 q1 O" ]6 a
} - m+ N! ~' y( E2 T+ S+ q( o
} . y" p; x% ?( L; s, J; d
chineseid = document.sform1.chineseid.value;
- _8 k# L& T" O; k! m if (chineseid == "") 9 v/ |5 s) {6 G* B7 K
{ + i/ O" k$ c' K: ]
alert("请输入中文昵称"); 4 d, b! x/ S7 m% w- P/ j
document.sform1.chineseid.focus();
% l1 ]- z, p$ D4 f' Z return false;
: v, n4 B% a$ p ?! u9 z }
$ w8 d6 H+ e. T Z$ K, x1 p password = document.sform1.password.value; 8 D6 c- G& a- w9 w* S9 ]6 m
if (password == "") : K7 K; ^0 F2 \
{
+ m9 Z% u0 W* k alert("请输入登陆密码");
+ [# A6 H7 n/ \3 R2 Y* d document.sform1.password.focus();
9 ?, V# Q" f- T) H8 S' G! c+ I return false; # d' p. E' G' w" v+ }, G
} ) d3 |8 m4 g, Y# Q" N- ]+ t3 i
password1 = document.sform1.password1.value; * p: X& U5 R( T7 N+ o. i5 m
if (password>password1) * L8 O, G2 \- Q5 [2 j! i1 ?& Q
{
* H. k7 y0 K+ g1 ?% d4 [8 W1 `. T alert("重复密码与登陆密码不相同"); / U' Y6 n9 w. {1 j" X- A; a$ i5 U/ }
document.sform1.password.focus(); $ F) Q& C7 _; g9 {
document.sform1.password1.focus();
8 b& x' y$ P% h ~ return false;6 H6 k' i$ k( V: v
}
2 q. @6 \5 h' d0 U: fif (password<password1)
1 P( [2 z7 O8 _5 { {
1 u4 e8 S' @& [! G; \8 c& c3 v alert("重复密码与登陆密码不相同");
, U5 p0 ]: r: X+ a document.sform1.password.focus(); 1 ?- f/ Y; n+ w$ B C
document.sform1.password1.focus(); ( x, J" ~, w" ~3 p& r1 t q
return false;
- `9 l+ E- j* H. C }
. q* F) O* t3 G& T9 L7 h) @ if (document.sform1.email.value == "") / [" u4 i. E2 l' N
{ # W6 @. B% d/ V
alert("请输入您的E-MAIL地址");
+ d, M, g# b. n5 }2 u document.sform1.email.focus(); * J! F; E- u' q1 K9 B& S
return false; " G: o8 a8 p; B
}
U7 Y7 }* f6 q4 u7 r" z! T
5 J6 o7 a% D: E& R/ Q h' b, [7 U9 Y, z email=document.sform1.email.value;
; d- g0 u2 p% Y emailerr=0 $ r& u5 [9 P. T7 {, ~
for (i=0; i<email.length; i++) 4 B3 E) J" p* K
{ # g# E. c& C, n) L. w
if ((email.charAt(i) == "@") & (email.length > 5)) - c4 }6 h7 D9 T2 s' E% {' F
{
" C) I( l w- r4 w% ^ emailerr=emailerr+1
" a% \4 ~8 G5 ? } 4 ?4 z5 ~- Z3 ]$ W6 ^. n; K0 o
} - A7 l7 x4 `& v$ N( w' H7 @6 H
if (emailerr != 1) * j4 w- P/ K# n8 P+ M! Z
{ ) ^" Q2 M5 U7 P
alert("请输入正确的E-MAIL地址"); 7 H' |9 F) N, y; S& Y! g
document.sform1.email.focus();
2 S: q$ }% V) N7 S7 H return false; ; f5 P# U) h+ g* k/ k
}
/ \* {" b; F& c- Z% Z! \- G
" I2 q2 F8 V; Q+ E if (document.sform1.checkask.value=="")
$ U2 S6 O% y; \; a { ; _& A! J! h, S: S. C( X
alert("密码提示问题不能为空");
; K( N6 T/ N6 R! d document.sform1.checkask.focus();
! _, [& X& M w* A# l' I {# n return false;
9 q! p9 `, `+ C3 R6 s }
# S+ z% o! P! u6 r$ P* P8 m1 ] if (document.sform1.checkans.value=="")
" B0 R' F3 i2 z% V: k% t {
$ _" k4 E3 B7 q, y, o alert("您的密码提示问题答案不能为空"); $ _' j2 b j3 b2 E
document.sform1.checkans.focus();
' ^3 p% I' @5 s. ?2 w$ g" S, l return false; ; K4 ]" M' v2 X0 ]- p+ U
}
5 [7 ?! ?9 O& o$ }' k. p return true;
e8 X1 T" h A6 f4 z# d8 G
" {2 v6 Z' n7 J" L! g2 P} 2 r5 v: b; Z9 s9 @ q R
</script> |
|