|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14337
- 金币
- 2454
- 威望
- 1647
- 贡献
- 1402
|
这个脚本对你可能有帮助:
9 q7 T7 R8 N c S& o<script language="javascript">
: G0 a- S6 ^% G/ Rfunction IsDigit(cCheck) 2 c2 _3 t( K' B# J; G( r
{ ! z' }2 F4 {2 Z; | t4 I2 S
return (('0'<=cCheck) && (cCheck<='9'));
2 i' L/ i3 C+ U } * R9 `- C/ g0 l# p( _
# O: t- F6 y3 _% Afunction IsAlpha(cCheck) . r0 ]. @. _ ]8 D4 k5 D# d
{ % J; ~% k7 ~7 S: e/ }, |
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% r# g1 S, D5 n( D } ' H2 z# H3 r8 _* v5 |. J4 H- {
( x5 ?/ }4 p! d% {. i
function IsaNull(cCheck) ! a7 A0 P: V+ D8 F# X( O4 S: p
{
4 ^0 j' c9 I* C4 R! V5 a return(cCheck != " ")
. s! t$ {0 S! ?& Z5 L$ c9 e } 1 U0 I% w* p# M* c& `" ]
" N B6 Q W4 D' r7 q c
function checkform() 6 S$ S0 y r3 I8 ]
{
5 c- M6 a9 H& h; z ] id = document.sform1.id.value; : k& g4 T7 ?6 F2 I( P
if (id == "") * e0 Z' k* w( X
{ 0 o6 }- ]9 J" }, c5 v
alert("请输入注册名");
$ a" e0 d, V7 V) i document.sform1.id.focus(); S. p7 e- ~0 W& a. H( H5 l
return false;
, U* @5 W/ H, | }
4 V- I2 U+ r8 u( \' k % B" b) X$ T- a8 j( Q
for (nIndex=0; nIndex<id.length; nIndex++)
a8 }& u$ N/ j {
- r& [8 O% c0 T3 D; r' \! c cCheck = id.charAt(nIndex);
+ z+ D M1 S. ?0 C; ?8 H if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 4 P7 Q: w1 X) U2 M' p+ D
{ ) z8 M; X0 ^7 ~, `" F! l# s
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); + M% K- e0 j3 v
document.sform1.id.focus(); : A/ s! o/ a6 D! A
return false; . s% q6 G# \ ` e
}
$ J: F( e% J# ~/ q* o v$ [ } ) Y' l! t0 Q& S) W/ w
chineseid = document.sform1.chineseid.value;
; r! M$ Z8 D; G, _0 H if (chineseid == "")
# K9 X! Z$ d- I: ?+ i/ c( q0 l { $ e/ d0 o* d" [+ K8 x, x% G3 X7 o1 t
alert("请输入中文昵称"); % M1 ?' S! y0 |- ?+ ~' N* p
document.sform1.chineseid.focus(); 5 B" u$ ]' ~) _$ d# _# V! h
return false; 9 R. |6 o" I8 e" P
} - K- x' w" x* R$ w+ f3 |, o" R2 y
password = document.sform1.password.value; + ~6 \. M# p1 h/ c- w1 v
if (password == "") 9 F- H8 n0 A+ w9 N% r; Z: ^& H' m
{ ; K' l- Q0 E. h# H8 v" }0 _
alert("请输入登陆密码"); 3 Z8 Q9 C1 i$ f1 y, w& g! Y; w3 o" G( x
document.sform1.password.focus(); . x. r9 d2 d8 J0 I+ p, H Z
return false; ' _4 E! D2 k% _4 h! H8 c
} 9 H, h Q% o9 P
password1 = document.sform1.password1.value;
7 x: a; k# y: {. U" C if (password>password1) 5 u3 n2 i: F1 N
{( d) f6 M( @1 `% r/ C0 j* M, M
alert("重复密码与登陆密码不相同");
3 H5 P# k+ i4 E# Q# w! F document.sform1.password.focus();
5 G' t9 u$ S$ C# u& V* {, `9 b document.sform1.password1.focus(); " k$ T5 f5 `: w7 l$ W5 Q' G
return false;9 C/ |5 B* n9 b U D
} , e- N( \, H( j% x) Z" `
if (password<password1) g+ ]) N: ` \2 b8 W5 y
{
t) s- F& m5 y alert("重复密码与登陆密码不相同");
: C$ [; {4 R2 K) I ], `7 @ document.sform1.password.focus();
7 e1 _" i/ o7 |6 R6 c% s document.sform1.password1.focus(); 7 X0 [0 P1 L9 N' A+ W* a0 V
return false;, z& \7 e9 t+ x3 a
} ) D$ k* K: W. x( |# U: S
if (document.sform1.email.value == "")
: l" r# L* u+ L1 A" u0 I' E {
6 P, r# C; Q& K/ L6 I+ p alert("请输入您的E-MAIL地址");
. C. s6 y+ Y1 K1 T1 [5 O document.sform1.email.focus();
8 _+ H5 q b9 \) t7 {& m6 J return false;
# \: G+ E- O0 g } ; r& Y% L% d, N& @' _$ |" X
- B$ H4 T, ?6 N! c email=document.sform1.email.value; # E( R& r P ?" Y1 {
emailerr=0
* t! P3 M5 r+ f( K$ r0 m for (i=0; i<email.length; i++) ( h h1 t& ~) d7 ^2 w$ ]/ [
{ ! ~5 Z4 G" B# s
if ((email.charAt(i) == "@") & (email.length > 5)) ! I) V; R5 i. }* v) _
{ 2 `) b7 [2 Y. r$ {' R( I% N) G
emailerr=emailerr+1 - U; i# _. g3 g+ h
}
/ M9 t/ F( ]) @" e' }# ] } # e/ E F" Q u# R$ k0 |
if (emailerr != 1)
& e. H9 M. x6 u" _: r8 g0 W% U# H% N$ B {
/ c$ s# n7 w* U: M# k4 M alert("请输入正确的E-MAIL地址");
; \4 e- X" v" x& l& b document.sform1.email.focus(); - Q/ h; T" A1 U5 J% H
return false; # d7 I$ d$ c6 ]# Q Q+ W
}
) U8 J5 w: I0 x$ A+ U- H. [# _# y; z 8 i, R" u. P. h0 L# t( n
if (document.sform1.checkask.value=="")
0 d# H4 ?" I9 _# L3 y- I! p7 U {
; A' v7 S8 p( t9 I alert("密码提示问题不能为空");
2 m8 L8 A( w! Z; D document.sform1.checkask.focus(); ! ^& h m* E7 U0 C- K
return false; # ?: ?. T: `. M+ C7 I
}
% N/ [) ?5 z' X& A4 ]: C& R! W if (document.sform1.checkans.value=="")
' x2 p- f W8 y6 c8 B2 | {
5 g" N W: `' K# C1 y alert("您的密码提示问题答案不能为空");
/ m. [) K9 e8 O% k; U document.sform1.checkans.focus();
' G& n( E4 D/ u return false; 4 E" _5 J- H0 Q: d# B! ^" M
}
7 ^( q8 D' H# A( V) | return true;
1 A) l$ n0 l/ }" Z; h$ ^3 D* w ? ! N0 i9 R6 T. W2 s8 U& _
}
3 a# W9 N" f. @, P9 a; G k</script> |
|