|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:1 O6 d, F5 s. y% D, e9 g
<script language="javascript">
1 o/ l3 j& X9 }1 q; vfunction IsDigit(cCheck)
0 Q: {# G& O! G6 @$ Q8 U- t) Z {
$ ?6 e# q. u! Q* J a, l) w' Y6 Q return (('0'<=cCheck) && (cCheck<='9')); 5 P. v9 N& [# q) w9 p- m
} % }) A+ I& ]' d; \
1 ?$ _+ \2 Q4 Kfunction IsAlpha(cCheck) 0 n) \1 I2 [% S) i. H
{
9 O* A- r' o+ I+ g8 ^ l- P return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 Y" ^. t* ~0 y; \+ p$ s9 L) W1 M } - Q9 H: J# T1 O# P( S
' E9 @( J8 e+ N9 V
function IsaNull(cCheck) 7 s0 d& H2 G8 S8 S7 k$ Q( P
{ ( P m1 _6 B7 A7 w1 s& V$ }4 f( _
return(cCheck != " ")
8 h! I" m9 }- ?4 D# Y }
: m$ e) N/ `7 \# j- g& y- N/ c% i - ]! o; o9 Z8 N2 g* ^6 r
function checkform()
. A) J* e' n ?. i" `{
$ z$ N0 f* [9 W' y% M( V2 S id = document.sform1.id.value;
& k( @2 h# T& z/ O if (id == "") 1 X2 l5 T5 I5 |' J8 L' C
{ 6 O# {( B; t' g1 R% l# N
alert("请输入注册名"); " G4 z/ R3 J3 _* I) e. Q
document.sform1.id.focus(); ' r `5 W. x( {6 c( o
return false; % m9 k) C; l0 j* y; t4 Y- U
}
) K6 l( L4 O+ ?$ X6 [& d 4 g |, W* m( @7 N" z* m
for (nIndex=0; nIndex<id.length; nIndex++)
( V+ S0 y w Q" r* `- u2 E; W" E {
4 r& I% C9 ^. K9 u cCheck = id.charAt(nIndex); , s! B: O" T$ n3 o* [
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 |1 a4 o# o% _- R C, Z* [ {
$ p4 q. l; F7 B* q4 L: N alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
- }. I6 M& O5 i. O document.sform1.id.focus();
; v0 [ e% p$ {2 G return false;
% M5 D% n8 D4 A$ F/ I! C }
3 O, O+ F5 X& J. }9 K }
" A; e1 ?" ]1 E: X. U; J( x chineseid = document.sform1.chineseid.value; 8 x2 V3 B/ g0 H# f! v
if (chineseid == "") ; m% B6 `7 }! |( R
{ 5 t d$ c7 s; i# a2 j4 m
alert("请输入中文昵称");
9 z5 Z9 s$ k! L* g, m document.sform1.chineseid.focus(); ; v. I: Y6 i: N& M+ e }
return false;
9 _3 N: }# P+ f P7 j" T, q/ l$ [ } + s: p% \% l8 m+ C
password = document.sform1.password.value; 4 h7 u0 {( i+ B8 Q9 B+ L
if (password == "")
$ ]0 F4 A9 m; @ {
7 i( q! x* ]4 }& q alert("请输入登陆密码");
3 y% x) G* k' Z$ l" V document.sform1.password.focus(); + S! G% P6 W% a: t5 l
return false;
4 Y2 x2 S3 V' O! k- X }
, H) \6 Z+ `" J# a password1 = document.sform1.password1.value;
7 m, c2 n) r6 s6 m4 r! Q3 V, H if (password>password1) , M, T; I: F; D6 E2 Z5 f: w( U4 ]7 _
{
, E5 \8 M& D$ F/ J; ]4 J alert("重复密码与登陆密码不相同"); 2 x' S( y; p6 s* h
document.sform1.password.focus();
4 Z5 u) j, J$ ^$ C document.sform1.password1.focus();
0 |, d& a0 }! \- \" X1 ^, G, _ return false;
6 q& Q, s, m+ D8 _' s; Y3 _ }
' k% ?8 N) |- k5 N) Pif (password<password1)
- e- S* h% ?0 `7 g( |0 ~ {
- _/ I$ s# a) I2 I% q alert("重复密码与登陆密码不相同");
' }, K" t/ p. n8 n# y# n5 I$ } document.sform1.password.focus(); 2 B: i* C$ }% ]! y' j. { @
document.sform1.password1.focus();
5 `, d$ T. [7 N/ ] return false;) O; J6 o+ Z) y% R( m
} 2 I4 t3 b1 |! D
if (document.sform1.email.value == "") ! X7 i3 i" C: X+ D9 i/ L7 G, X# s8 O
{ 4 m5 Q2 ~1 b; D1 M6 w3 y) z6 }/ W) p
alert("请输入您的E-MAIL地址"); 7 |1 B3 w* }5 }- x
document.sform1.email.focus(); 3 J* H m; o; \: u2 U# {/ \
return false;
& O6 |0 O( r1 ]' Q }
% J4 _: w% N+ s . o3 F- t9 U1 J! Q/ r
email=document.sform1.email.value; " f9 Z2 W) w' t! p& v4 d0 h1 n( u
emailerr=0 6 O+ ?" Y4 F6 G9 X. ~
for (i=0; i<email.length; i++)
. Y6 c+ F j8 L1 w8 j+ B5 u( z { $ n4 T' U$ k1 t# X) N2 s$ h" ?
if ((email.charAt(i) == "@") & (email.length > 5))
. q) m2 ]( x: c! h- | { 7 F2 Q% a! `) j- T
emailerr=emailerr+1 ' w- S0 y( k0 N
} 4 N# C' a7 T; \/ J4 b0 l1 o
}
0 N; v# \1 S8 C; L, O/ S if (emailerr != 1)
- ]: ~5 `, L" s j. _. ? {
- L5 M0 e4 K. @# X! y: m( D alert("请输入正确的E-MAIL地址"); 3 W" _% a0 }9 X1 h% `
document.sform1.email.focus();
E0 T0 E+ W8 r3 S; r' n" n; f! y return false; " G. S" A5 l+ K; N
} 0 k% q% `3 h/ K
# Q, o4 f3 s. X' g
if (document.sform1.checkask.value=="")
, D* Y1 J j9 `5 m) u) f {
! h2 E' h J& x) _3 F alert("密码提示问题不能为空"); W' ~3 I, _) ~ O. U: w5 A
document.sform1.checkask.focus(); + V. F& Y* e; Q8 z7 ]( s+ V0 K
return false;
( X+ T( u* ~" b7 B \ }
. h# u. T( t, Q, y) _2 H if (document.sform1.checkans.value=="") ; p/ d8 I# g6 r) k+ l# f, X1 o
{
. B: p$ X6 ^3 ~ alert("您的密码提示问题答案不能为空");
; I* R) r7 j6 P9 K6 i document.sform1.checkans.focus();
7 r- E2 ]' ], g" x return false; & |! U% S5 i5 v; h' s' W
}
# F# Z( A; y- y return true;
& B" j4 D! i) | Q2 i
" \5 X5 E h8 z2 o4 m} 5 M1 k' V; f! @( {
</script> |
|