|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
这个脚本对你可能有帮助:/ O4 l+ ?* y5 o
<script language="javascript"> " h4 |+ x7 V" M; l
function IsDigit(cCheck)
/ I7 m4 N6 p4 @& R {
: i% C4 U1 h" E; t' T return (('0'<=cCheck) && (cCheck<='9')); / c4 ^! H5 B% S# H8 }
}
' @, u" A( P1 J' ` 9 ` B2 Z/ Z$ M2 I& h
function IsAlpha(cCheck) ; H0 Z! ~: m) \9 F5 u) X! O
{ 4 k' {* C9 N: B( U6 |% B, h0 ?6 j
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
6 F+ c: L! N. j3 l1 t } 4 L: B) ]) D: U2 Z" ?
5 y$ J$ V4 w- T S6 y9 nfunction IsaNull(cCheck)
4 B! p, P2 S$ i# f; P0 ] {
* B& e, E0 O6 o* n6 W* f return(cCheck != " ") ! }. ]& N$ v) n8 o: J2 y2 S
}
$ o y& I' h7 Y6 I
8 Z' A" X5 V( Sfunction checkform()
1 t- O" Z% L. d. E7 X{
' ^1 C& o2 }9 x& f4 l9 P id = document.sform1.id.value;
+ l' L# ` @6 l3 K; D if (id == "")
/ x" R0 u# ^- i2 q G { : Z, }5 g. W: K: S
alert("请输入注册名"); : }3 f% e# r. `: e
document.sform1.id.focus(); 2 C/ H% @# R7 w, N0 {$ P6 r
return false; ' A4 W, \# w2 s% W- e
}
) _& c8 D, h b" ~ ; Q3 ^/ m5 B% U
for (nIndex=0; nIndex<id.length; nIndex++) , C1 C- M. B: r0 c/ g
{ 9 p, A! _/ ?6 ^
cCheck = id.charAt(nIndex); : r7 z& t# x4 X( T: [9 a- b) b
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ' w- F# V; L; N0 i+ c. i8 \
{ ; h3 L) E* p0 f3 e
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 8 e2 t/ Z' `* s! [/ t
document.sform1.id.focus(); 9 \4 `, S" j; _" c( _% \
return false;
7 N3 `4 K" R. Q8 S, M } * a9 x% r0 f6 d& p1 z8 ~
}
5 L7 f, I# [9 r- \- x chineseid = document.sform1.chineseid.value;
% D! w l0 A: l3 g. U# S if (chineseid == "") 5 E; i$ h1 A5 D) c& w* c
{
6 ~0 y& ]1 i) o alert("请输入中文昵称"); 2 j! d, n4 n2 p+ G ~4 R3 B
document.sform1.chineseid.focus();
0 n$ M0 X, o# t return false; ( |2 \! E6 p( [9 D; {
}
3 }' x' H7 Y8 P& V password = document.sform1.password.value; 3 V# v% ]/ J2 x) k e$ _
if (password == "")
?1 p1 I( X+ r0 ]" m- s { 7 I- N# @( l8 p' X- N& [
alert("请输入登陆密码"); : g) e7 [ |+ g- n1 Y
document.sform1.password.focus(); 7 m& m- }7 M0 T# A( X/ E. m! q. R8 [
return false;
s: B! b3 `6 Q9 a: h& n } ; S4 n* v% Q5 r
password1 = document.sform1.password1.value; $ |; A7 c- e8 X9 |! J
if (password>password1) 5 M' R" O2 N1 g" D
{# j: E2 L1 n. g5 Z! k
alert("重复密码与登陆密码不相同"); * E7 }- v2 C- |
document.sform1.password.focus(); ) ]4 [% H4 I" g8 h" |: e6 j" Y; H
document.sform1.password1.focus();
# }5 {9 {0 `# y& r7 N. R! D return false;0 r) n$ V7 N2 \ d# g7 g) `; Z; s* @
} : J c1 A5 f% |4 K/ O2 [
if (password<password1)
" q1 _' S8 G/ _+ `2 B( C8 t {
+ e5 C, H/ b+ L( M9 P% _ alert("重复密码与登陆密码不相同");
! q) L. f) J4 D& | document.sform1.password.focus();
9 C+ _6 |/ D2 b4 G document.sform1.password1.focus();
- [/ k5 w8 C9 A% v return false; L/ S$ v! P. w! e0 {
}
3 e n. S8 f3 W ^: v; T& Q% @. a: d- [0 K if (document.sform1.email.value == "")
/ S$ ]5 q/ j5 u' \1 _2 G { + A7 j) a, q# o7 K' m" X1 {
alert("请输入您的E-MAIL地址"); 1 w% e d& s8 S3 m7 |
document.sform1.email.focus(); ' p; `: N2 E1 n4 R4 E: }' ]
return false; # H; f. i) h! L1 l- @
}
- s8 j2 ]- Q9 t4 Q$ C7 Y, f; U
1 s) P9 l8 J" ?+ F9 f email=document.sform1.email.value;
7 V. H. m% r( t. I, X [8 i6 r emailerr=0 0 P H4 G$ K) \6 J
for (i=0; i<email.length; i++) ' K4 G6 @+ \3 r
{
, Q* Y# D1 z6 A. ^: G" x; o1 W0 ] if ((email.charAt(i) == "@") & (email.length > 5))
+ R8 g- c' a; c5 b$ g5 y5 L7 d {
2 h7 J. }3 {2 I# [, |1 g) R: g emailerr=emailerr+1
& B0 g, U5 J5 @0 o. k }
/ j5 C* O% X4 b } & P6 f' o! ]8 [3 Q& B _/ ]
if (emailerr != 1)
$ p% }. W# z% `/ n5 ] {
( X, y) ?/ a& J, A+ k& Z. J alert("请输入正确的E-MAIL地址");
& @3 I- T8 M5 G6 H+ O document.sform1.email.focus();
% q1 a! z4 ~) X& {$ h( \7 e- _ return false;
* q& U# N: q4 H1 K7 x0 t" f4 }& f } ; a: z$ f- @" Z- c
' V% Q* Z2 T5 O( d3 O! b9 H
if (document.sform1.checkask.value=="")
6 n A1 H' C' N \* | { & n( n6 Y7 b2 j5 V- t( Q& Z
alert("密码提示问题不能为空");
4 n1 N# m! j6 x( \6 v' F4 l0 U document.sform1.checkask.focus();
# R; t$ t, H" {6 N4 U return false; ) C2 A2 C k9 l) f5 \
} 5 R/ a: L, U: g2 p
if (document.sform1.checkans.value=="")
+ t/ r8 b4 d1 {$ v4 A { & h, M9 j8 Z8 q G
alert("您的密码提示问题答案不能为空");
; b. _9 |# D) d+ c1 d+ Y document.sform1.checkans.focus(); : |$ v V( u2 z; c5 C+ t
return false;
! }; d4 |4 \1 ] }
5 Y; C" |) c+ A1 I9 B3 \ return true;
" U/ Q5 Z2 e+ j
9 k% V8 g N8 W+ a: j' h}
: O. A! K. g9 P</script> |
|