|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助:+ P0 m4 Y3 T9 N; G! m
<script language="javascript">
6 I9 z/ M+ c/ S( z8 t4 pfunction IsDigit(cCheck)
1 d) A. a6 Y1 ~8 k: a {
2 l' q" F6 [: `/ D return (('0'<=cCheck) && (cCheck<='9')); ; N1 J; M6 v/ C. J/ T. F6 x5 j. L
} 2 t. [% h: Z5 U/ }
, O0 l' F0 }( C: P( y4 u
function IsAlpha(cCheck)
0 J3 I; w: B: ~, q2 y: [" B { 2 w/ S% Z2 d8 \9 |
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 o: d3 i* s, e! m }
& F+ X. ^0 t: \! T8 y
& D8 v# g: z! {function IsaNull(cCheck) & r+ _+ p) ^4 O( Z1 A
{ ! J1 [2 t% L4 `' |4 g( l: P
return(cCheck != " ")
/ Z* Q1 N! F) h2 k2 } }
! D3 g9 F' K/ h( L2 ^ [) C9 y, J5 u9 M+ N, V% o4 b
function checkform()
5 u( E) V/ R6 s{ 5 \; ]6 _- r& c9 {
id = document.sform1.id.value;
9 X% g0 f9 }+ o# \+ \. ]& c3 Y if (id == "")
% N) e( C S* d1 [7 M; V {
~; ^: ?5 t F7 }: D alert("请输入注册名");
9 J! M) g( Z$ f* H8 Y( m d3 s document.sform1.id.focus(); ! m/ |. |% z# F4 E; H' f
return false;
3 j7 G8 R3 I7 A8 l0 x$ K2 h } : m2 T3 x/ C. c G
5 Q9 F) _; R/ L6 w
for (nIndex=0; nIndex<id.length; nIndex++)
, u1 m& s1 L! W' t% ` { 4 R% Z7 e1 c: D% a5 p# N! k+ ^( n4 _
cCheck = id.charAt(nIndex);
& A/ ?8 c- N- s7 _( O( k if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ; Q* l# z2 ]# \6 {. W- S2 b6 ?
{ 2 O% U$ d' `/ U
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ! X; I$ }4 R+ u1 x$ I. Z8 C: [& C
document.sform1.id.focus();
7 @: |% c! r$ G return false;
, u) V: U2 [! J+ q1 p2 O }
8 s8 _) F9 T/ @' p, | } , a- s6 a! v' W! v
chineseid = document.sform1.chineseid.value; 3 E. p- v7 ^1 _+ e
if (chineseid == "") 3 r. u3 c- m5 O) O! ]
{
9 O8 ~% C; T# l' q; k# E alert("请输入中文昵称"); 6 q4 o. S2 x5 v3 c9 n
document.sform1.chineseid.focus(); . Z) w: Y, S( C' E% u" x1 }
return false;
* R% B( C- z2 \0 P }
' y/ v$ W0 n1 ~2 Z( Q6 I password = document.sform1.password.value;
8 C0 x7 u2 m8 g if (password == "") 1 u8 |# q5 t* }3 e1 D
{
9 _) |; \8 D+ u5 [: W alert("请输入登陆密码"); / w8 I& h0 c7 r a3 ^% ~0 u
document.sform1.password.focus(); 3 M1 X' k; l' Y+ {% F/ c
return false;
9 |8 Q* s0 X/ Y' \! Q$ k7 k } & p" ?3 n; O6 h. x7 t$ U5 ~
password1 = document.sform1.password1.value; $ b: [& o1 J! t3 _
if (password>password1) 1 W$ q I$ ~3 [/ h$ }! N% X$ \+ d
{: }4 Z5 |1 }. j! u6 f
alert("重复密码与登陆密码不相同"); 5 l# x" b$ n3 L: r) _
document.sform1.password.focus();
; d9 P1 A; `8 l5 w) q- e/ v document.sform1.password1.focus(); , V- Q" G# o, d! V# z! L" {
return false;+ q. s/ @$ j1 F' n6 Z; \2 m2 j
}
7 Y& w/ g6 W4 }8 ]# uif (password<password1) ( e7 n, B" o2 |* ~* B
{
/ Y! Y; T5 g/ ?0 y' Z2 ]* y alert("重复密码与登陆密码不相同");
- x; L# h+ J9 i" _' }, } document.sform1.password.focus();
( M) n$ a ^$ W- u8 n9 I1 Y9 w1 t- K document.sform1.password1.focus(); - o0 p9 o( P1 }3 @* ]
return false;$ D+ c9 |2 v- I* h
} 8 ?( C! a# m' ~# S& C
if (document.sform1.email.value == "") ) r1 s% i" L" ]2 @8 V8 _2 {
{ , ?4 @7 N9 F9 C2 k# g l
alert("请输入您的E-MAIL地址"); * i6 J5 g* Q$ p; J: C+ J' @7 G
document.sform1.email.focus(); $ b8 H; [6 i# Y# n
return false;
" h H+ A8 y" V' s% M } " ~5 q& T" T: i+ w
. G. O4 B/ ` w: f9 G email=document.sform1.email.value;
. G& u6 B' _* H7 M- c+ K emailerr=0 ! K/ B3 D4 K: T6 \+ p
for (i=0; i<email.length; i++) # r5 R/ i# q# L: z( g/ E$ L/ L
{ 7 r4 J. R! ~3 u. D
if ((email.charAt(i) == "@") & (email.length > 5))
0 N) ^+ k3 _) f5 W; w {
4 ]1 {, S3 l, {1 K7 H9 `% j emailerr=emailerr+1 8 c) e' w \+ q7 z! r
}
) d1 A/ D/ {' ?( ]: }$ ^/ H( ^ } 6 h" ~ [+ _3 t+ D6 f j3 E, D9 |
if (emailerr != 1)
. ]8 C7 [+ @3 M1 } {
5 N- K1 t& {4 |# p# | alert("请输入正确的E-MAIL地址");
- S; P. R/ F4 `8 }6 f7 h% _ document.sform1.email.focus(); - n. x4 w" J3 W( c; R
return false; % l! h( | T* t$ M5 O' e
} 0 S) [9 ~9 f9 O
1 n3 b6 D0 r- v0 @4 }+ z) `( k
if (document.sform1.checkask.value=="")
; u* q1 Q% A, @3 [ { 6 Z3 |2 Z8 L! R( `
alert("密码提示问题不能为空"); 8 u- \% J2 T0 i7 W. f) b# S2 e4 U
document.sform1.checkask.focus();
. i1 d, f: D; R( K8 { return false;
k$ d J8 `; w }
K8 ^) e- _! _( {: c5 _$ n! n6 W2 L if (document.sform1.checkans.value=="") % `# q: U: Y. S* m5 c
{ 3 j+ R; X. |4 G! W9 K
alert("您的密码提示问题答案不能为空");
3 d" Q4 Z3 P/ N4 |0 { document.sform1.checkans.focus(); # Z% n. F4 P- W3 z: U- S
return false; ' w0 J L2 Z& R1 l7 E0 s1 \
}
+ M- |2 y" k! ^; |) ~ return true;
3 [1 e5 ]! x9 j' o4 {% R7 b " b6 \" w' g" N; L$ m; A
}
( R7 v& |2 C( l: s* n; Y7 z</script> |
|