|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14419
- 金币
- 2495
- 威望
- 1647
- 贡献
- 1443
|
这个脚本对你可能有帮助:- f4 X( G6 q- y
<script language="javascript">
F5 b) x" k* U6 |3 F( [function IsDigit(cCheck)
( y" y) I) E8 P- N* [! l- ? {
{& ^2 A8 p2 B$ q9 E4 ?) k return (('0'<=cCheck) && (cCheck<='9'));
+ v) v) M r; M, a* v# u3 K }
9 S+ B; ~7 q; C" P4 F4 r) T ; K1 i( F# _, h
function IsAlpha(cCheck)
" ~( u/ n) ]& n: ^9 c( o { ! \( q D- ~! P6 l* Z
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) " f/ Y- P; u+ {% k2 y4 b2 E
}
! O# ?) S- y$ C- M# I- H) |
4 H! O8 b) c; _: I2 R& A, Ofunction IsaNull(cCheck)
% H) V2 k$ Y8 K {
$ D! I+ N1 `. s4 Y return(cCheck != " ") ! h& {; C6 V' @, S0 M! F3 l) d
} 1 x2 w* Q7 h5 ?# j5 u
; B3 ]8 v* w- @6 w
function checkform()
$ ~4 ^% J* @2 o! [{ : @0 Z! ^1 n1 o5 R0 Z
id = document.sform1.id.value;
$ ^; Q0 V) `0 ~ if (id == "")
, X5 o* e: E) z; [' ]: o {
; Q, c0 j/ @" S; `2 ?0 o" A( f; e alert("请输入注册名");
7 T2 g3 D; M, @ m1 n- Z. J document.sform1.id.focus();
; e; O" l' Y e2 \1 L: j2 Q, g7 h: c return false; , V: l! i5 C* X- ]" ]% I
} 5 E2 n; I# C, @2 ?. K0 a
2 |7 B* O# K. f, h' i6 o/ A for (nIndex=0; nIndex<id.length; nIndex++) 0 T I* x' Z8 j/ }+ u
{
" K9 ~5 l6 a! o8 H6 K cCheck = id.charAt(nIndex); 8 d4 G- |& v3 O9 Q( t
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
- {: s/ ]( \4 [5 G { " Q- U; N9 o: O) ~0 f5 C8 r, O/ u. ?
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
/ J- H0 e6 D( q. e; u* Z document.sform1.id.focus();
. B( V9 x( ]0 T, V- K4 P/ g' r9 H return false;
4 j9 [9 Q: L2 ^( x, ^ }
7 ~2 a( Y, G5 ?+ Z }
" {1 y$ x3 F! q! Y( Q9 t- l- ~ chineseid = document.sform1.chineseid.value;
9 D5 E8 Y% P" ?. \ if (chineseid == "") 0 B- D) N' E* N
{
7 }- V1 G, ]2 E0 M+ U5 _- v5 | o alert("请输入中文昵称");
! ?$ m3 i* h2 _ document.sform1.chineseid.focus(); 7 i: B" U0 t1 L0 y, u1 R
return false;
3 e0 ] b4 S) Z: H! s }
" l% D# i5 e% S+ n# ^6 H' L9 h) G password = document.sform1.password.value;
6 Z- k, w2 r6 H8 I if (password == "")
4 r+ k8 H9 Z+ X {
* w6 v" ` S- i' k" L alert("请输入登陆密码");
, E0 c7 Z! {2 v, d document.sform1.password.focus(); ' O6 ~( s. J9 X
return false; * ]$ C% t9 m2 p5 H
} + D# H8 a$ v! }' g( @
password1 = document.sform1.password1.value;
( B) ]0 w9 c; o& X- \9 n' \ if (password>password1)
7 O9 `- l" G9 t {) V0 k; O/ w2 H
alert("重复密码与登陆密码不相同"); b0 G2 ~+ b; D* }) ?% t% }- e8 ?
document.sform1.password.focus();
3 I8 R* X! c V( ]4 ~1 ]8 k/ ~ document.sform1.password1.focus(); . z2 @$ V$ o+ C5 s' J- J
return false;, Q4 {: H6 y3 \: g
}
) i! G# E2 Q! ^5 z2 { }3 bif (password<password1) ) _1 ]% {- q$ Z$ _
{
; a, O, B3 e5 R* V alert("重复密码与登陆密码不相同"); * y6 E* }3 S, L
document.sform1.password.focus();
2 K, E6 ]4 T+ a9 T. [( n document.sform1.password1.focus();
- v- C0 S; R- ] return false;* I& C1 C4 K/ n8 J
} ' d' g, [* ^: z$ Q+ I5 h6 S/ q# Y1 e
if (document.sform1.email.value == "")
, [+ A* l( z- ~ { 6 V% q) W& E0 U: g4 p" }
alert("请输入您的E-MAIL地址"); 3 H1 O- @+ t. O! ?" \
document.sform1.email.focus();
6 e. U) q! r" y9 R( N. y: j4 ? return false;
1 a I# R! n+ w( O+ Z; j) Z+ t$ A } 7 r9 G% B, _3 i! Z) D9 A
! O [. [" \0 y8 B# b
email=document.sform1.email.value; 0 u2 g/ {7 ?% ^0 U/ G2 ?' T
emailerr=0 3 t0 Y# @$ f, R# V
for (i=0; i<email.length; i++) N, ^8 {, k9 L; @6 w
{
) [# T# e; d+ M0 p9 m9 m if ((email.charAt(i) == "@") & (email.length > 5))
& x h, u0 }$ n8 U3 r6 U { , R: T! M }; ], ?, [* @
emailerr=emailerr+1
, l" m& C# ?3 k& b3 A } 0 `2 y' e1 |9 s9 u3 X5 r6 e" ?& h
}
; Y7 D |7 \3 b# J- z1 o$ U8 k if (emailerr != 1)
/ F5 z6 Y: I% Q' N4 |& Z3 j, ~6 a {
* O; X" [2 B2 y: Z8 D6 d/ u3 z/ _" @" l alert("请输入正确的E-MAIL地址"); 7 n: G3 ~6 d3 @6 V8 T
document.sform1.email.focus();
) W5 J* c I4 U8 Z/ N return false; 4 U4 E/ F2 U6 j' a
} 5 E8 H, r/ Q, u: A
. P. e e3 H& t! D
if (document.sform1.checkask.value=="")
+ n( |7 s8 u1 [6 V! D { % {/ f- n w* u0 Z6 g- T
alert("密码提示问题不能为空"); 1 b) f$ Y1 ], E/ _' E: `. i
document.sform1.checkask.focus(); ; d, m# d3 A" W! F, s4 O. f
return false; z$ j8 f& o9 R& [1 d. X- e
}
9 p K, {/ b! D% Q( v( F if (document.sform1.checkans.value=="") 1 R* C( d* d# a" H5 C
{ $ G- t. O# C% A* M" s7 X
alert("您的密码提示问题答案不能为空"); 8 W2 E: |9 k, X& a' L
document.sform1.checkans.focus(); ! }! f; s) u( a5 _/ d w' B5 D
return false; ! B% s: M2 B2 ^
}
/ k! h6 F+ i% }1 q0 B) w return true; % \* y7 O' a% w. m8 i( o
- G9 P. \+ d s+ L$ w# f0 V}
4 r r' l! [! } D6 U, `& c" Q</script> |
|