|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:/ ~9 Q( l7 v6 N. D/ v" ^
<script language="javascript">
% \, s8 K0 Q. }% p. i2 Lfunction IsDigit(cCheck) & L) ~& A1 g8 I! ]& }; L, i4 u
{ 9 {$ j, _1 a) `0 |$ Y2 H
return (('0'<=cCheck) && (cCheck<='9')); 8 \5 g+ ~6 R' Z) \6 } I
}
, B; n4 ]2 |4 ]( m) X. {
; e3 o; u$ R/ sfunction IsAlpha(cCheck)
& ^3 h- c' I7 c, B4 }% { { & S" _& W; O3 c) X4 B* k3 \! M( Y
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
& ^& f2 }. n& x8 @% ^- a+ U } . h$ G; V8 f2 c9 ]+ H
% u7 ]' x% j$ G L* C2 B$ t8 i
function IsaNull(cCheck) * F8 y- Z1 X: o* t6 R6 @1 b4 x
{
1 C. W$ u3 n; a0 k$ _ return(cCheck != " ") / X# m- F2 d' @# m
} 5 J @2 u. u. r; i, N
" Q1 m) I I! L0 ~$ l% bfunction checkform() 6 {1 i+ n S* A% D
{
. }6 D i' S- P/ z id = document.sform1.id.value;
9 A$ I6 S" U. [ if (id == "")
z7 R O7 G. a( h- t" \: K {
`) R# K: { D2 w: p alert("请输入注册名");
( c; I7 V' }; S document.sform1.id.focus(); 4 x/ N2 A. ^( W5 R$ E0 F6 [# Y7 c0 |
return false; 0 d$ }1 e* V I5 |6 Z ]8 ?! @
}
( o0 N- l) v. v$ p 6 [+ u3 N9 m9 ]
for (nIndex=0; nIndex<id.length; nIndex++)
* B. _8 Q, {( P3 O {
: m' W3 c7 f9 B+ b3 h cCheck = id.charAt(nIndex);
# e1 }, ?) V% z7 c5 {# l if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ; _8 k5 L* e% n$ J
{
9 d& u0 w6 c9 W6 s0 c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ) q2 _8 Q. R- u0 }# }
document.sform1.id.focus(); 4 |& B3 e" x+ @3 \
return false;
* V; r0 l' D; A } 8 e5 B1 ^# v1 ^0 p& [- `/ p! P
}
$ z" L1 I* S4 [" Q5 ~7 t chineseid = document.sform1.chineseid.value;
; J% Z; R! Y2 L( k5 _( p- M if (chineseid == "") - n/ }! x; {* @
{
' g+ `2 d6 |3 s! D& M& t alert("请输入中文昵称"); # a* C: n) }- A, z
document.sform1.chineseid.focus();
$ O" M* \6 \0 v2 Z return false;
9 g( a+ B0 e* u* L' h } 6 H7 V4 n/ i9 ?" S7 I
password = document.sform1.password.value;
$ D- y1 H+ s; C6 T+ h if (password == "")
$ {: G8 M4 ?2 R: p g {
- J# z7 D, f+ g( |. ` alert("请输入登陆密码"); + k3 n, W/ r. j; B" t
document.sform1.password.focus();
3 O5 l m7 u; L% R7 D return false;
% b; x4 [2 p7 P$ s4 H } v% C$ c# Q6 y: `0 @! a
password1 = document.sform1.password1.value; 9 I/ m* L$ R& d7 H' \8 P9 V
if (password>password1)
, v# }- F+ o& |: s6 D& Z7 W {
; |) M8 L# X2 \5 k) j) y2 c% p alert("重复密码与登陆密码不相同");
' u A& l9 ?+ z& t o8 G$ Q# W document.sform1.password.focus();
. N; M* R$ h% L6 ~. f6 {! R5 x9 b document.sform1.password1.focus();
1 m9 @, u m D3 k' I7 | return false;
. K3 b L9 E) I) O+ D6 m0 l9 N } 7 w5 v6 w4 r* V- @4 W
if (password<password1) 9 _3 T0 n3 b. a+ l9 d h
{
/ N3 |/ g* w( V/ ? alert("重复密码与登陆密码不相同"); ( r, H/ E( Q) Z! j
document.sform1.password.focus();
: O, Y w$ x4 m document.sform1.password1.focus(); ! a% }) O1 W) Q# f' ^# T, y
return false;
+ {1 E7 y& w3 q) e2 T8 ~( a }
4 r! i- d7 R7 ~$ t if (document.sform1.email.value == "")
5 {4 u6 c5 ~3 D {
1 t7 M3 b% a% w1 d' P+ h alert("请输入您的E-MAIL地址");
/ j! X8 a! e/ L document.sform1.email.focus(); . h( W- D" K8 P S0 V+ ~
return false;
( P" t+ D& k: U6 l0 U" { }
1 m9 R& k& a) w$ L, p( D , u8 W8 t4 k. o) |
email=document.sform1.email.value;
( c2 i8 R. R- S+ x; \ emailerr=0
4 x" t$ O* L1 ~1 g' D for (i=0; i<email.length; i++) * c% Q L$ Z0 E: J5 \/ T
{ 0 l3 ?# L) w; n
if ((email.charAt(i) == "@") & (email.length > 5))
8 z! v& W3 u# j { 1 t$ k _ n' w0 r" i
emailerr=emailerr+1 , d& j6 a) b2 M
} 8 {% h1 z/ a1 H( F# t6 y: E' K
} ! h; u/ Z. `0 X: U2 a; `
if (emailerr != 1) ( d( J: h% K4 A6 x3 t2 G
{ . r/ k! X n% x6 h6 c/ O
alert("请输入正确的E-MAIL地址");
9 M) q6 {# q# `8 ^; F document.sform1.email.focus(); ' y/ J* p- E, g$ o- A4 [
return false; ( M; c# y- o. }7 n5 |/ K2 }( p9 t
}
8 B( @. \6 B* e( d& G ; n3 L! G7 t3 `& }# |+ [
if (document.sform1.checkask.value=="") 8 H. D( R! ~& X( ~3 q* q
{ # W8 p9 F. D0 V( h: T0 e
alert("密码提示问题不能为空");
4 x$ z: N6 ]3 ]' s) a8 O: H document.sform1.checkask.focus(); ( `! N) Z1 F% m, W- t1 e
return false;
$ Y$ T: T. S; e a6 ?, n9 w% ? } . q2 u! s o' Z6 g7 P1 l6 W2 S$ \
if (document.sform1.checkans.value=="")
. c4 @3 i6 z3 k5 |. k" { {
( @" I! }. H2 g3 G: F) _* l alert("您的密码提示问题答案不能为空"); % Z. \, t9 s' \
document.sform1.checkans.focus();
" G4 g% O# N, j5 D+ m return false; C4 G5 f% Z; ?5 S6 _; e
}% o) b5 p6 z7 H0 H* a" m
return true; ! Y6 z4 O. v: |% ?/ w' u" J# f# p N
# F8 P6 q) m. P9 h} 1 ?6 I1 w0 Y" w, Y H. ~
</script> |
|