|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
这个脚本对你可能有帮助:4 `" W6 g W0 l/ a, S# f6 O; x
<script language="javascript">
5 C0 N" z6 J& V% t& w( J2 K: Cfunction IsDigit(cCheck)
2 a" {1 M% U- O# m/ q { 6 @$ U0 {$ G; U) p5 g7 U
return (('0'<=cCheck) && (cCheck<='9'));
4 C/ h* d9 y/ ~! g }
7 G9 m3 @3 V, C8 h; L* p4 {; C , K! _6 d3 l# b% r8 }6 n J
function IsAlpha(cCheck)
- b. j: G y6 q9 L0 L) R8 Y {
% n" |( P9 U4 ~4 g) u3 X) z' {+ g# I3 z return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
+ l' p4 x/ y7 g } ( i, Z7 b# I, l
7 s1 u) E1 ~" Z% C& m
function IsaNull(cCheck) & h) o9 @) y! g% y" K* P7 i0 v5 J2 I3 P( w
{
9 T& ]6 _2 l7 P. }8 j return(cCheck != " ")
$ P' Y4 V, g- B }
5 T+ c, f5 L0 z: R7 Q9 z ' Y5 D" n& a, s7 k# f
function checkform() ! I6 m* D V4 z0 C% [2 p
{
, @+ G1 @: s2 Y* |! H' a id = document.sform1.id.value;
) ~+ ^5 b) `+ f' o% w4 G if (id == "")
& m0 C- k+ ~# I5 [ { ! _$ W" k6 k4 ~* k! W% |
alert("请输入注册名");
2 }/ I7 u$ I9 \- Y document.sform1.id.focus(); 5 ?$ }& V4 r/ @* D6 @' A
return false;
u5 S& A3 r1 f0 ] }
4 r4 ^; F5 N+ j
& n* Z7 ^/ U& `/ |* g# } for (nIndex=0; nIndex<id.length; nIndex++)
9 @, O+ h! _* i+ A# y; n3 g {
& V0 d' p- }* P# f cCheck = id.charAt(nIndex);
1 x( s; F" k3 a; C( o ? if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ' [% ?5 f1 F3 R% j+ q* {
{ 9 T1 l+ v; ^. |- ~1 a- G. _
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
, X+ s) Z9 |' M5 N document.sform1.id.focus();
* _% P# R5 l' v: X return false;
9 O- o! N( [0 q }
; S4 G, H6 E( i. t6 { } 8 k" S- }3 s! J9 A* P0 W5 `
chineseid = document.sform1.chineseid.value; & n) p( @* s4 Q. V7 _- {; B! ~$ b q
if (chineseid == "")
6 ?8 O/ d) n- V* X7 R4 ]) w* C {
, [8 { u; \" y! f( @ alert("请输入中文昵称"); ) H& d/ l- |, a8 z
document.sform1.chineseid.focus();
& `- Z) U0 g: q4 {8 c1 ^- a* q return false;
( b* q( r1 f H2 _ }
6 {% Q% i0 v8 } password = document.sform1.password.value;
w2 r4 L% K$ @1 U7 k" r" T: n/ u if (password == "")
3 k7 R0 |& \9 B" _* }; [ {
7 k3 q) |$ v4 Q1 ?) d* r alert("请输入登陆密码");
) o; q" U( s9 z& l) ` document.sform1.password.focus(); ) e6 M, ?! R+ ^( b" z6 l
return false; ! h. \- [/ n) p0 C# x
} 3 g: {) Z. h: @( i
password1 = document.sform1.password1.value;
6 X: f2 |2 K+ ]* O if (password>password1) ( c+ [# {) u& j; H2 F
{
2 h4 i9 I9 u* }1 l& L! U! ? alert("重复密码与登陆密码不相同"); 1 Y" B. ]! n& D6 X
document.sform1.password.focus();
+ K% T6 g7 {" k! P4 ? document.sform1.password1.focus();
" ?5 F, j; V. f, K7 Y1 j return false;" q+ g; I; b3 @5 n3 C
}
! x) w0 E# C2 {& Bif (password<password1) , {; U: o( Q. {! ?, D
{
7 J! C8 G) @7 H) P/ X1 h: M0 n0 \! V; T alert("重复密码与登陆密码不相同");
: t: [$ B# M! R! N- U: u document.sform1.password.focus(); ' q8 c8 r% Z" K, t
document.sform1.password1.focus();
: }& R9 m q9 `5 S1 R: c return false;
* `7 b0 H7 L! @; F; R( I6 n } " ^, d2 U, X: c4 V- q0 s
if (document.sform1.email.value == "")
3 Q& y, X# u& t, [ { % K! S" Q" O: ~8 o6 y) R
alert("请输入您的E-MAIL地址");
" ^; C: P- W- b+ b3 e8 R document.sform1.email.focus();
8 P. u. f" d2 l/ M8 H) t% z return false; . F$ x5 K! e5 H3 b( u+ @2 d! P
}
, a, H9 |6 O( }4 w. p 2 d' y8 s! L3 ?# I G% s0 T
email=document.sform1.email.value;
& G) J) G" a8 c: T* C emailerr=0
' @) I( u; H. d3 {# p* q) r2 e for (i=0; i<email.length; i++) ) M) `) F6 E- T. J0 _- j
{ * Q7 z$ x6 Z3 }
if ((email.charAt(i) == "@") & (email.length > 5)) " q& E* u& Q) I' X- X; N7 [5 P6 @2 m2 O
{ 0 q& k) z" J& W+ @: I1 N
emailerr=emailerr+1
8 R0 f _3 M* R# j }
$ d+ n% i1 i: F/ ?( e } 5 r/ I# ~1 O7 u# p! M
if (emailerr != 1) - v- Q+ x" O% z; N
{
* H5 A9 l( V* ~3 x' J alert("请输入正确的E-MAIL地址"); ! p* A, e$ N$ f4 x3 f
document.sform1.email.focus(); : [% M$ F" ~. Y
return false;
& @4 K" f; g9 J0 _( _, @3 t } $ R3 x. l8 ?" b' c; p7 o
8 F3 W. K& ]+ Y' N
if (document.sform1.checkask.value=="")
* k. g4 W( @0 a" i y9 L0 M" k+ C { ( h1 R% B( }6 Y! ~3 C; V" A
alert("密码提示问题不能为空"); % [' Z/ b& Y/ }; h- T3 u1 t
document.sform1.checkask.focus();
0 z6 C" ?5 d' a2 e: G" ~; b return false;
' [3 W1 o E6 h7 Y" z# |4 S2 C }
6 Y) d" |7 _! {/ o) ?7 F1 h2 f if (document.sform1.checkans.value=="") % G1 }% _! ?- i+ x Q# t4 E
{ O8 P9 u1 c1 j- F3 L
alert("您的密码提示问题答案不能为空");
?- ?, K0 Q* a4 Q1 M8 T# _ document.sform1.checkans.focus(); ! U1 C+ t) d* d( R0 N( o* T
return false; # v, g/ V1 l1 M. X7 u$ E% {
}! @8 f- H9 |2 ~' O+ x# h) q
return true; ; t! M$ Q- r' l
2 r3 Z/ @) |# Z: r; C
}
7 @4 @( \7 \) u( x3 ?, i d</script> |
|