|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:1 N# h5 G: e6 C* w3 |4 V8 e" u, n
<script language="javascript"> 7 u$ _2 B. K/ x, T- w
function IsDigit(cCheck)
' e" m- m0 x# Z! F# ^1 q {
7 z+ A+ j. B* {/ a w: v return (('0'<=cCheck) && (cCheck<='9')); " e; D0 Z; h3 A5 P
} ; V- P! L6 g, S5 b& {1 c4 o
9 W9 a' B0 Q, k, ?
function IsAlpha(cCheck) 3 G. z& t) k y" J& A* R" C2 }
{ 0 ?! \: f% A' p% M
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 w2 X6 C! B' L
}
: @8 b$ G( d Y6 v# Y* ?. y # j; i+ Z7 u. S6 D
function IsaNull(cCheck)
0 z6 N0 Z$ A6 t! R+ a" u& g {
) v, p3 n1 t, a2 F; y return(cCheck != " ") 3 ^# k8 c5 V6 a% l; w4 `
} 1 s) |+ t, B% ~5 U7 N; V
7 s4 F6 t. n- I$ M: g: lfunction checkform()
, ?' I+ j% Q l# W# J{ * V! \1 J3 Z0 X
id = document.sform1.id.value;
* P, h6 }* R- y, x8 O: ` if (id == "")
$ Z+ P2 |9 _* G% Y5 x T& M { 5 s; p# E& I/ b1 s* e" w; d; U$ W/ ~$ ~
alert("请输入注册名"); # J9 V, |- T" p2 W4 D2 c/ T
document.sform1.id.focus();
$ S4 u- X; G+ }5 | return false;
3 Q$ e9 y: m* D6 i' q } 1 ^9 p0 Z1 M$ Y" e5 z) B; `: D
, ]' i5 y f% d4 W' A for (nIndex=0; nIndex<id.length; nIndex++)
& g; o- M( {. |8 b) g4 y0 C {
( `+ W% i5 U# g6 b: _ cCheck = id.charAt(nIndex); 9 R9 W& P& W: _
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) # }3 I. m1 G: j0 r
{
2 Y/ d8 }$ ~6 \9 n: y alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , @& f% b! o; t1 X3 O" O+ i/ ~
document.sform1.id.focus(); B- h9 ^: D4 s4 G( B( @. j
return false;
3 A$ |$ j! F1 x2 E5 q# r }
8 \) \# {9 n- W+ y% A2 W$ @% U. s# G7 C } + ]% @6 l- X1 l* v- a3 o3 \
chineseid = document.sform1.chineseid.value; 6 e# i/ B0 S& b# ?7 B3 a+ w$ P1 m
if (chineseid == "") 3 s! `" B, ]' l" e, o. ?0 V& V
{
) q+ q( L! J* n/ k; Q alert("请输入中文昵称");
% H4 m( Q$ m; G8 B% C document.sform1.chineseid.focus(); 5 x' Z) Z: t$ ?& e
return false;
/ W8 q: m* P7 p4 q: J/ _# p } : t' Q7 d. c( H- l4 I) [# F1 x
password = document.sform1.password.value; 0 L3 c: Z/ ~+ X" I- O
if (password == "")
! z9 h' H. S }" R- Y {
$ j0 D1 p+ w' r alert("请输入登陆密码");
) ^5 W# t T7 R3 M: w3 |- M1 N5 z document.sform1.password.focus();
# p. r" z* {- G! M" i return false;
6 j0 _8 H A5 G- s7 _6 G" X } $ B _0 Q( \# ^- h
password1 = document.sform1.password1.value;
$ P- Q9 z' H5 F& r7 @ if (password>password1)
, _. j0 Y ~5 Q6 \0 T3 j {6 i( ~/ R8 f) X& W, [8 b* F
alert("重复密码与登陆密码不相同");
# E& S4 M! @( e. d document.sform1.password.focus();
" ]$ Y8 [/ A' @, [3 L J8 E1 c document.sform1.password1.focus(); & H1 K8 u5 a8 Z6 P" r1 O, J
return false;
M( T" x1 w0 i }
7 c T: \& M0 c$ \) @, Q3 uif (password<password1)
. L2 ]$ |- }3 X {
% q/ a" t+ h# P alert("重复密码与登陆密码不相同"); $ t" X. [ _- m; O; Y5 p
document.sform1.password.focus(); 9 t: g, o7 L- n% J; E8 i
document.sform1.password1.focus();
$ ^! T% ~! W) P" a" l return false;
$ r( U; o- Z4 k* R4 ]) ^/ p }
( A! q* u, `$ B' S# }5 z5 q if (document.sform1.email.value == "") % Z' |( R9 q3 X" s! V( ? B
{
H) ^7 `8 A4 t o alert("请输入您的E-MAIL地址");
, Q0 A, T; }7 Q2 \( D5 E) K document.sform1.email.focus();
( C, E. z. ~% Y' K$ [% i# t$ z) G return false;
& N5 z8 [7 }0 T6 ^ r } % _8 `2 t6 p) ?: l# n9 E
- z, {3 Q6 \" w* _ email=document.sform1.email.value; ( z. o" _4 e- C4 k6 V. G f
emailerr=0 1 w( k' p e) L, M/ L) i
for (i=0; i<email.length; i++)
5 l8 ?5 X9 E+ x6 e8 ^# z { # ~! s6 H U, R
if ((email.charAt(i) == "@") & (email.length > 5))
2 U f. Q+ }" q4 E {
: L1 o+ i" Z+ v* ?* ~, I emailerr=emailerr+1
: G1 X* \0 U: }( ?* ~ } ! b) H& f, x) T0 ?1 [0 g
}
( b+ N3 k% k6 J# i9 v% m if (emailerr != 1) ! W7 d- u" j" s+ m2 L
{ 9 W) S& O" M9 [1 O; g
alert("请输入正确的E-MAIL地址");
7 {( Z1 q( r5 J- r6 [2 M document.sform1.email.focus();
/ t1 d# i- S o+ { return false; 1 }2 F( ^# i, O1 O& d
}
, X7 }: X: a- W& i: w! b6 Q 9 Q( W1 J- R. Y' X, ^' s& X
if (document.sform1.checkask.value=="") 0 J6 s9 |7 E7 W3 z& U0 y
{
7 s4 }- F: J1 ], @4 U! A6 B7 W7 k alert("密码提示问题不能为空"); ! R& P" W' `/ T
document.sform1.checkask.focus(); ! I. Y2 B! u' v/ T) g6 R
return false; L' n( B3 q( R6 n4 L- q+ B
}
8 r: h! J$ Z- T! }/ \ if (document.sform1.checkans.value=="")
1 |# m, m+ a, F; @* F { ( p6 d c4 Q) n! f/ t+ h; X$ J
alert("您的密码提示问题答案不能为空");
4 a1 P% v$ ~6 B* p& |4 O+ E document.sform1.checkans.focus();
- a; {9 P- ^4 T4 y return false; + R( P, _, {$ T- P7 h$ v
}- q3 S" A/ z& A- D+ A( _; e& T
return true; - R* `6 n$ @( S3 d1 d
s7 T- ~+ Y' _
}
6 j5 ^8 z- d! O/ l+ I; k</script> |
|