|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14403
- 金币
- 2487
- 威望
- 1647
- 贡献
- 1435
|
这个脚本对你可能有帮助:
) Y! y3 w; h1 S- H. ^<script language="javascript">
" T" F- J; ]( c" B* I4 P2 G! xfunction IsDigit(cCheck) 7 B1 D) V2 K3 [* s
{ - P2 y0 [/ o' X+ v* ~+ q
return (('0'<=cCheck) && (cCheck<='9')); & n8 z1 n) f- w; l4 f
} # Z1 L, R& g$ M+ X) w3 c. o
, S; F. O& i% c: u
function IsAlpha(cCheck)
; Z D" I: P7 W. w% x {
& x! K0 i1 \ P7 a; `+ n return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
/ _' s- i8 `* G1 {! W3 ` } + J3 E. b' J1 l+ i: E
% h3 _+ c1 s% J
function IsaNull(cCheck)
* R7 Q# C" e! a { ' T+ N7 t# X+ k Z/ D8 k
return(cCheck != " ")
2 k' h- l9 z7 E; O9 H$ [, R h }
Q* t, V! K' x
! z( {( \! C. }* k8 w+ T) ?function checkform()
! R! _( z4 A: H{ 6 A! A9 s$ ?: l R( n2 o" d5 o. f$ n5 v
id = document.sform1.id.value; ) p1 e: t7 q+ H! |7 F6 `6 k) H
if (id == "") 5 n1 b$ s0 u0 f+ K, C# w
{
8 U% {2 ]& t# I; o alert("请输入注册名");
% w' D3 [+ J3 m. J+ n3 _ document.sform1.id.focus();
" U' S! x7 @ k' ^! g+ Z# P" c return false; ) _7 H; A5 D- k0 i
} 9 \4 Q! U0 S- t+ U" F! ?
) v6 y" j. m. H& p8 Q for (nIndex=0; nIndex<id.length; nIndex++) ; \, H2 a; a# q& D8 k! |8 e3 n
{
7 ?$ e ?7 o- C* A: \. R+ p7 }4 n" q cCheck = id.charAt(nIndex);
8 Y+ A7 b1 L T2 w% n6 A2 {; Q if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) . V9 ~1 g: z/ q& B, Z2 O+ v7 ~2 F0 l& g
{
* Y, |$ E' U. v9 g7 Q4 K alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' v! a3 x$ z/ u document.sform1.id.focus();
6 Z! Z- _# q9 R& Z6 f return false;
- X7 s( l+ v* g } & q4 ~, B; X% R$ F/ f
} & m3 N& ~. |( @" N8 X. W5 s+ }
chineseid = document.sform1.chineseid.value;
* G* P1 {3 d6 m9 u& q if (chineseid == "")
! N* M; I. q5 y- @( b { * K* k! p- p0 \
alert("请输入中文昵称"); 6 O" \% U4 S/ \
document.sform1.chineseid.focus(); # _7 {3 I) E1 ^. A
return false; $ p( |7 O0 A0 E7 o
}
6 T( H4 p* `) R, [9 c" \ password = document.sform1.password.value;
& c) j. V R2 u3 G( i2 g if (password == "") + l- A$ t( ~4 a- H
{ F% P, F, Q2 \/ d, q5 r2 B7 W
alert("请输入登陆密码"); ! g( V! F) b% m! u( s/ S
document.sform1.password.focus(); & R: x$ _0 M! H+ I2 V
return false;
, j9 i8 i! {0 H; Y } ) p+ G3 b1 v1 F% r
password1 = document.sform1.password1.value;
, V. f/ P8 V1 \/ s& Y if (password>password1)
+ q4 ]# \% V* g7 a {& f" o! {6 A8 p5 ~5 m
alert("重复密码与登陆密码不相同"); $ `% b3 ]1 Q1 m: {
document.sform1.password.focus();
' u* R! T e( U4 s& ~ document.sform1.password1.focus(); ( v* U7 A$ V, i# ~* l
return false;( D+ A2 w' b& o
} 5 c7 V* w/ D9 c1 ~
if (password<password1)
% Y9 @( ?$ a$ ^ {( ?+ h) X3 K. m% e# ?/ g3 x' ?: _
alert("重复密码与登陆密码不相同");
- Y- C% `% i1 x- ` document.sform1.password.focus();
0 d- R- w% K& x" u- G document.sform1.password1.focus();
- w& S8 h& L. g' y' g+ ]1 J return false;
+ q1 G$ x1 j# S& U- e/ I0 j } # P$ s7 F! L$ t2 u! f$ c7 X
if (document.sform1.email.value == "") + ]1 c( l) ~8 g
{
) \7 e. O/ o4 M" l* d' ^ alert("请输入您的E-MAIL地址");
; |; p; d" P' ~& } document.sform1.email.focus();
! {" b! x% N- m( [" B) P4 ~ return false;
+ {1 ]) C. a8 e+ ]+ T0 Z }
, i" P4 a! a9 O* A: Z1 ]( T $ o# D6 ?' j- _( g8 r1 i
email=document.sform1.email.value; " H, R: q/ u8 H& g! q* O L
emailerr=0 4 ^4 b; k5 @" Z# b, H
for (i=0; i<email.length; i++) P1 H: p( B2 K/ L3 G; b& d
{
& Y2 I0 _8 k6 E: l3 B- w! U if ((email.charAt(i) == "@") & (email.length > 5))
( F. d c; f: p8 R6 U { % @6 ?. [* {3 {$ [! U' r: A
emailerr=emailerr+1 " {; b5 t' @2 R/ u9 j6 z
} 8 X$ r5 K* S2 {, L* h
} 4 L1 O; u2 B0 z- Y: m. X
if (emailerr != 1)
5 S: `$ h0 Q3 \ _ { - {( d# K* }+ ?
alert("请输入正确的E-MAIL地址"); 5 b: d) T- n4 d
document.sform1.email.focus(); , ~$ M. @; [8 ~
return false; & G' `) [; }4 g9 h# K. x
}
8 x: E4 S: V- a6 O4 j . R4 j5 Z( t# [: e* K$ K
if (document.sform1.checkask.value=="")
3 D, R+ w! Q8 E" A { 4 [) Z6 e7 q7 U
alert("密码提示问题不能为空");
+ c/ F; g( ]* O# d( E; X document.sform1.checkask.focus(); , b5 f0 o. q' m# \
return false;
! i( Z( [' d9 W$ H, Y2 n' e( g } # e" ^4 G) n& M4 z" r6 `
if (document.sform1.checkans.value=="") / f' v" e; q4 v! h6 j6 H
{ s# s" @1 y" ?% k3 {& Y" P
alert("您的密码提示问题答案不能为空"); " S* C% s7 K Y1 n# M. U, E/ f
document.sform1.checkans.focus(); 4 \! B- w1 [; B: ?
return false;
& D$ D& i) L' l$ q) p9 G }1 M9 C6 K5 Z/ M* f: I
return true;
; L, A' J! r3 L4 I( @% Z
3 {0 ?: S$ ?% N( D% `4 c7 Z}
# R- v2 i w1 P9 Y1 D! {2 L; y& o</script> |
|