|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
这个脚本对你可能有帮助:
# o+ H4 [' {/ H- \% D- I<script language="javascript">
6 B2 ?. r' ]6 r p9 Zfunction IsDigit(cCheck)
# f! l5 A4 [2 f' |7 ]8 b/ M0 c {
" ^0 O; ~" @' u# G& s return (('0'<=cCheck) && (cCheck<='9')); : O1 p' T4 N) R" ~9 b9 @: D' ]+ f4 h
} e, z# l! n) C# h* V& Q
6 n, D' K0 t7 y2 Q/ C' M' d$ v/ x
function IsAlpha(cCheck)
" n, V8 j$ g- B' L! \+ W3 K { . L& }7 F& C5 B& x: I" _
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) % G" f5 _* Y# Y5 H# ~1 D( @
} b, L. H- _1 `0 a
5 y0 a5 Y6 F5 B9 ]7 u5 d) @function IsaNull(cCheck) ) i! a, w$ ~& C1 |$ l
{ : w3 E0 i8 j3 c, w. r4 s
return(cCheck != " ")
$ d" f$ Y; o! k+ e. M2 H2 f/ ^ } . Q& P3 o0 v0 n3 ^
/ S6 `# B' v: K# Y1 Q) o$ N) O
function checkform()
# r: Q& [8 M5 B. j& m) O{
! \. s4 T" { T! \" d id = document.sform1.id.value; O: ?6 Y" Z. w" V" R+ q
if (id == "")
" r) S7 J) }4 ~. _! u8 A( F6 a$ S { . f2 X* }: p. ?; R* F
alert("请输入注册名"); 2 d8 G/ D4 F3 \3 L# b
document.sform1.id.focus();
7 l9 R$ ?" c7 M B M5 P6 O return false;
# o& f7 T6 Q6 ^, v S' G3 I6 M } ) q8 A% v* V7 o0 D9 Q
1 S# r$ @- I$ T7 f/ q& S for (nIndex=0; nIndex<id.length; nIndex++)
" ?; m2 d% J& T! R% Z3 b { ; E3 I- A$ a9 {2 K# g
cCheck = id.charAt(nIndex);
. ?; \! V; W! a5 g if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) Z7 X5 J$ x b& t T
{ & s, A) _4 D5 u3 P7 S2 q% D7 l
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
) L5 n% M9 X2 E p5 K document.sform1.id.focus();
* ~4 U& u* { o% \( h4 z* e return false; % {( d1 D' I, R2 n0 a
}
& }3 V# ^+ d' O( j$ @+ @ }
; s" C2 s" d+ s chineseid = document.sform1.chineseid.value;
& X1 _. O2 y4 U if (chineseid == "") 8 M2 |7 q6 n( O! S, [" I! ], ^
{
* j. N1 z$ m5 `7 t$ \ ]3 q alert("请输入中文昵称");
1 D9 e) v; t" H) M4 ]' H document.sform1.chineseid.focus();
; p% a0 }3 q; p7 J3 U return false;
2 S2 I! @' z. i: C- d; b) a+ S( X \( Y }
% @4 e6 _. j! u; x# D D password = document.sform1.password.value; ! _* ~/ g3 [8 n0 I+ L
if (password == "")
: l- e; A( f- @: h. Q6 D4 U { ( z) r5 D9 ]- g6 r( t$ b# {8 _4 h
alert("请输入登陆密码"); F8 R+ T2 B8 R2 Q) `
document.sform1.password.focus();
4 V3 g# v# l- p- E/ ^2 q4 _ return false; $ O5 l: w% r+ A# M, J0 v
}
0 J* J' Z# ?, [- P; b password1 = document.sform1.password1.value;
9 v; W6 _5 d e2 V- [+ m8 ?1 Q if (password>password1) % |6 m1 C3 A: w' m) q3 b
{
$ ~8 R; C. f; D' Y4 n, X alert("重复密码与登陆密码不相同"); " p# ]& z9 E- K. [
document.sform1.password.focus(); 6 S# h( A; R( u
document.sform1.password1.focus();
) h" G) v3 S. N return false;
/ C, d. z8 [$ I } 1 Z* L2 M1 y/ n& d
if (password<password1) % Q& a+ d* B/ [' y& C* v* p9 n
{& g" k( L% o* G. A4 R% s
alert("重复密码与登陆密码不相同");
( t7 g; c. S- T document.sform1.password.focus(); & M* }, I; E2 ^; y7 \7 x5 _4 e
document.sform1.password1.focus();
7 i/ K4 \5 n- k! J& ~ return false;
0 Y, C: u5 H, I Z4 n- a: C& i+ O) y }
$ {8 v- ]$ d& _. D; F0 F/ s if (document.sform1.email.value == "")
* t- z" n! D+ G. k+ L" Y! t7 d { 6 Q# G3 W2 y6 z! e7 e
alert("请输入您的E-MAIL地址"); ! _8 |8 R3 K$ s4 Y7 J
document.sform1.email.focus();
* P9 p% h" y: x. A3 e return false; - W" g( x. h; h, q4 D' d% M) i6 Q
} # H8 ?% V6 r3 \$ D" P+ m
+ ~* S* f1 W6 P9 v S
email=document.sform1.email.value; 6 B2 _8 U- u* u0 y
emailerr=0
% q+ [& ?& x9 |& F( p for (i=0; i<email.length; i++)
& F* _7 K0 I* z {
4 p- N& o+ q! u4 |1 y7 Y4 ~ if ((email.charAt(i) == "@") & (email.length > 5))
0 R5 K" P B T, }$ G { - l3 U& M% a9 @
emailerr=emailerr+1
9 X& E3 U f( ^* ~ }
; V9 Z# @9 u8 _" M8 k6 @7 m } ) M' J! ?6 b* C! E; B
if (emailerr != 1) # o/ B8 G3 {& |7 S1 Y8 M
{
& r/ y. @: _, N' D) O* [ alert("请输入正确的E-MAIL地址"); 8 E% p! ^0 s" G2 {3 f
document.sform1.email.focus(); ! Z9 a, e/ v1 U' G2 s6 o1 t
return false; & }5 M( g% r# [7 s1 l1 s7 K
} ; j/ b a& M" X4 V M$ C
- x2 h+ }1 M! E8 K if (document.sform1.checkask.value=="")
0 X6 X0 O2 L5 H1 S! j! b3 q { ! I% _- A# g+ m& P" G
alert("密码提示问题不能为空"); & a9 F" s- S8 m3 i8 y5 U
document.sform1.checkask.focus();
2 R% z- v. h$ L return false;
9 U6 u0 d, ?9 J9 N/ i$ f } y. N0 P: y, K: ?9 o/ V/ ^
if (document.sform1.checkans.value=="") * x7 M+ x' A6 L( c
{ 8 M h" u" W9 q
alert("您的密码提示问题答案不能为空");
1 t- W9 W- T7 o, [ document.sform1.checkans.focus(); + d7 f) O+ ]$ ~0 ?
return false; ) x( m% n" k; u j) h; t* ?* i
}+ p- b5 E! D* o- X3 s
return true;
) q( z% R, U- @, s - ]( ?2 Z# h7 y1 C5 w* k! I
} 3 O% w/ s0 h5 y; ?" l) \
</script> |
|