|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
这个脚本对你可能有帮助:
8 d* y, y9 _# C2 [<script language="javascript"> 5 ~: H% }+ M# H1 T7 ?/ J/ f! O
function IsDigit(cCheck)
3 e, T1 J# G$ A( i: `3 y { 0 x% e3 B7 F2 ^; j; W, X1 M. k
return (('0'<=cCheck) && (cCheck<='9'));
& A+ N8 g& L, L! q } - b8 J" A$ X# m1 E3 v
, Q5 s3 h$ B' L7 }- Tfunction IsAlpha(cCheck) * ~5 K7 v7 q" o Z. g; o3 K- T
{
! c" y% [% a3 K- g: F return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" P; _! y7 A6 f2 E5 Q }
8 V. H" e+ ]. r / e1 S% b* k1 i L1 m- G
function IsaNull(cCheck) 0 r7 i% _% B2 u, v( c& @6 c
{
$ v8 E4 C- v% Y# Y4 g, u return(cCheck != " ")
& I) B$ l0 i, J+ R1 ?; j5 { } $ ?1 {2 u/ j; T
' d% C$ T, s4 X! Y
function checkform() ) C8 e& f1 s* {4 \, a
{
# a2 o0 `! p9 F. Y5 P id = document.sform1.id.value; 8 c# p% D7 U8 T
if (id == "") ) e+ i+ S+ @" N
{ ! w8 W4 n" F& S% g, p
alert("请输入注册名");
3 ~1 K, h2 ~, k1 @. k8 ~& A3 S document.sform1.id.focus(); 6 e: `/ R; S$ i" c; L) ? c
return false; ( Y1 q$ _$ k; h( Q
} 2 L0 ]9 {. A0 ~7 U
* L9 a, X. t8 d9 n7 L for (nIndex=0; nIndex<id.length; nIndex++)
0 w% O+ P! E: @: m4 Q U1 u { * i1 h' T' d3 l3 q( p! @% B' z" C
cCheck = id.charAt(nIndex);
* H# i# [4 b8 d" f( H! P& d if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
# n8 N* ?1 E7 ~2 C* Y3 L! P+ g { % Y% g& L/ x$ l5 i8 d2 h
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); # ~, f7 M% B9 L( t! A3 `* P; X( P0 T
document.sform1.id.focus(); . s7 l/ J0 k6 V3 S* X4 C% ^
return false;
$ C! ^# X+ \6 T+ S+ e& l7 E4 Z }
. C" z2 l8 V7 L c5 E7 Y- y }
% V: f. m( }4 q- p chineseid = document.sform1.chineseid.value; 3 Y+ i& B! S4 c1 m! K, o
if (chineseid == "") 7 g- c0 O# p- n% q, m. m4 f! G6 r
{
6 B1 h4 l' }. D' Q# g# r' m6 v, _ alert("请输入中文昵称"); / V9 g, y- t9 w. _
document.sform1.chineseid.focus();
e; t1 \3 E$ @$ z" z return false;
, _0 z& ^' C+ u8 R8 C } 9 X; W5 w, a9 w2 }# F; y
password = document.sform1.password.value;
/ E7 Z6 U7 p# g' Q if (password == "") 1 J" y" K y' B( P
{ 9 m B2 C/ t9 _4 B! y+ x2 T' V1 w
alert("请输入登陆密码"); ! R) l W) k( v! @
document.sform1.password.focus(); 2 |9 v/ J, B: Z/ X+ Z
return false; 7 T- h3 I8 g7 s5 j1 ]6 I. s" x
} / o, S2 W' w, a: e- b
password1 = document.sform1.password1.value; ) M% e9 |$ z5 n
if (password>password1) % S; P5 }/ D& L6 L& _1 ^
{8 D. B$ `5 d. o9 I0 t( Z& U
alert("重复密码与登陆密码不相同");
! P, `( w2 J3 S7 U; y$ F document.sform1.password.focus();
: z9 r3 f9 P p document.sform1.password1.focus();
, b$ M. k' j6 ` H, U4 \; E return false;
! _0 H3 h' H* P7 V! Y }
7 R# I$ y: G. o) u: W- \if (password<password1) 4 N* u7 |3 V! B' b8 W2 u5 l! J
{& G- R1 a) x! T' F3 G
alert("重复密码与登陆密码不相同");
7 b7 G. X7 K/ _* Q# x9 ~2 i7 {6 C document.sform1.password.focus();
^' J, y$ H% M3 Y2 c8 P7 F document.sform1.password1.focus(); $ n6 g! }6 M' `4 P4 b
return false;
+ Z+ ]3 G5 `0 M4 @+ f6 y } : Q+ W# f$ ?" v3 ~/ E# t [3 y
if (document.sform1.email.value == "")
# t+ B; I9 f6 Z5 S. f {
+ _* R0 e, @- i- a+ C' A alert("请输入您的E-MAIL地址");
& e6 f: l5 W& q* W& @9 W8 j9 \ document.sform1.email.focus(); 7 h' Q5 v. j4 r- v# d* @9 L1 z
return false; . ]9 _/ C; E) [% [7 W. [& x6 u
}
7 ?$ i' q8 m; G7 o8 G; f ; c( H& G9 T: A% E5 Z
email=document.sform1.email.value;
3 x6 c9 \- N4 U$ c2 S emailerr=0
! l% v5 {* R) f' J6 {; h for (i=0; i<email.length; i++) + f: o$ d9 z: ~: P' c3 s
{
5 |" [1 E8 n7 I% p" A) E if ((email.charAt(i) == "@") & (email.length > 5)) , A3 R7 @, h6 X6 V4 g
{ . A6 ]" O( H% e" {0 z# v8 p- R
emailerr=emailerr+1 ' [" U7 A1 \6 M
}
~; \ Y1 K# n* l h' A" o }
9 g7 D$ r2 F4 S7 o- m5 W" s5 ~ if (emailerr != 1) $ G9 o/ E/ w8 e" d/ j0 o
{
9 Z* {5 \3 s- D. ^6 ^, s alert("请输入正确的E-MAIL地址");
1 N4 E( o! b. p/ N1 d% }8 W4 b# W document.sform1.email.focus(); 0 R% W2 v* H% Q. X! o5 K
return false;
+ e) r6 _; R% ?4 v/ C } 6 W& [$ R5 I$ X. s$ k& H3 `2 y0 T: y: D
5 P6 I9 ` o1 @& Z9 T$ B
if (document.sform1.checkask.value=="")
/ a: w, C0 M# b/ C. ~+ _ {
. o$ d# \+ K3 v8 t alert("密码提示问题不能为空");
- K: P# l2 j7 y4 w document.sform1.checkask.focus();
) F7 m- I" {6 Q9 _6 Q, B3 X return false; + P4 z, `: G5 S0 I
} 9 K6 X; O, l6 O, f
if (document.sform1.checkans.value=="") ( T" W' a2 b" P/ x
{ ; i5 T O1 W8 g% @" S6 E
alert("您的密码提示问题答案不能为空");
x, \7 V. b, c& j document.sform1.checkans.focus(); 7 \( q: @4 m1 T- c
return false;
N& O8 y% n- K }# a8 f5 F3 p' M+ [; g6 @ c0 @
return true; 2 B2 P7 u2 U! `- E4 I% k( Y+ s
( t0 \9 i4 w+ V% t5 o+ F}
5 i" V7 a, l$ j5 b" c" |0 E</script> |
|