|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助:: `* p+ U \4 J9 ]4 X' J2 U
<script language="javascript">
+ Q7 H, W1 d. K5 e; G0 u" w bfunction IsDigit(cCheck) - W, l, J' {' r2 b8 a6 ~
{
5 ~% @* j, @; k; t1 U- | return (('0'<=cCheck) && (cCheck<='9')); " l5 [9 U. Y! y
}
0 o" [: y' _. H* g! z % _4 D' ` w/ s- g. J7 f
function IsAlpha(cCheck)
- F% ^( [! T, l3 Y {
% R' Z( m5 ~9 s8 T return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
6 D, F: x! R# o }
/ r6 x& [1 `- m4 R) J6 r/ X# R ! [0 ^; } \. Q- Z Y
function IsaNull(cCheck)
! a9 @; p2 w7 n( Y W { , W- g: W. T5 x
return(cCheck != " ") ) a3 U9 f+ u0 y& m( V
}
4 h) n2 Z7 `* k. i. z; U
$ V" s% |) Q6 i9 O$ Q) q8 Vfunction checkform()
g% G- ^, _2 y4 r% B{
* W5 v/ g+ j0 y f0 ] id = document.sform1.id.value;
2 `) X4 p% Y4 x# f if (id == "") ) Q1 i4 m9 J! n. v7 S0 K: I
{ 3 U& \+ S [) [! [7 {& g
alert("请输入注册名");
2 i, \* [- ?7 A document.sform1.id.focus(); 4 ], n" D: D5 s+ e( L; m+ a
return false; " j& h, a! ]0 S0 Q) F# a; _
} + u! Y. y6 F6 T W! J! u+ l
2 X1 v$ ~: u& c( V' A" D H
for (nIndex=0; nIndex<id.length; nIndex++)
) B. ?, m7 P' Z' W b { 1 Q" T: |4 D' k9 ?
cCheck = id.charAt(nIndex); & p( L' d. M0 H
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) E) Q9 P$ b8 J% J6 X8 ?
{
) f+ [9 M- c1 B alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ! X4 j/ U! e) y: }! e
document.sform1.id.focus(); , S9 e6 G! c/ |3 Y
return false;
$ L4 w+ r1 [$ h3 c$ U$ b/ o }
/ J5 X9 m6 w$ q. m. r3 @" _ }
& E$ [% a3 g' a" ~& ^% R- K- } chineseid = document.sform1.chineseid.value;
; b1 P/ {- D- ^& Y5 B& [ if (chineseid == "")
- W+ C! }2 B3 y { % g6 I9 ]% w1 C$ k3 K7 [
alert("请输入中文昵称");
$ d+ q: P" Q i4 {: E document.sform1.chineseid.focus();
) H: D" Y# o5 ?( E( ?% H& ] return false; " ?1 I7 |; g4 c% q5 F. E& m
} * j# w, C3 h- ~6 S/ g
password = document.sform1.password.value;
0 ~# }& U; V- |+ Q if (password == "")
6 g9 y& ?* G t; j3 r" Y {
2 O K: W2 i7 Q6 z alert("请输入登陆密码"); / T0 o7 @) s6 H, Q8 J% _9 }$ v
document.sform1.password.focus();
$ i: T, U3 I2 J- r& I5 P return false; % Q: ?8 Q }; `, A; J
}
1 q! l% t/ T+ F7 d7 k7 U9 w) Z password1 = document.sform1.password1.value;
$ b J/ Y" O- O& ~9 A5 M' y if (password>password1) * j$ g0 y7 J6 F$ n. i9 F- X
{7 n# _( z. J- F9 b6 I3 E/ E
alert("重复密码与登陆密码不相同"); ! b4 S* ?9 ?# L6 U3 `+ X+ ^
document.sform1.password.focus();
/ }2 A/ E a; N& n( W; }* d document.sform1.password1.focus(); ; s5 Z3 F& b- f0 u8 o; h4 v
return false;' N+ X* w0 d3 x; x9 A! t
}
# ]) C% V1 c5 F" S1 {if (password<password1) 6 S4 V# V# R/ ^/ q: d
{# b5 ^9 R- d: R( n3 o# m2 g
alert("重复密码与登陆密码不相同");
& e* x& W' T' P1 P document.sform1.password.focus();
( a" p; y' W1 a/ a document.sform1.password1.focus(); : r0 O2 i" C# w
return false;. y/ E+ h# J0 E8 L% B
} . C9 g& \2 y& S
if (document.sform1.email.value == "")
$ t# _( C3 u" z' M0 F6 E {
" {3 i" D8 U6 f8 h& L: t& b1 r3 } alert("请输入您的E-MAIL地址"); 7 {0 c& B( Y) A' K& c9 n; }
document.sform1.email.focus();
: f* m8 c, u. Y' z3 m return false; ) k$ s$ T2 z) e8 l* [
} . w" g8 P+ Z9 e- X: i/ K* a1 y
; E( o D, o3 _2 f& g5 u
email=document.sform1.email.value; ; f7 `* x& e0 }& m
emailerr=0 : r B6 C0 ~- V+ Q* e( L
for (i=0; i<email.length; i++) : c# p- w: S" q( f1 ~: W
{ - J V w$ P) S8 g/ ^* q6 k
if ((email.charAt(i) == "@") & (email.length > 5)) 6 [- C+ K6 e$ z/ F( A8 X
{
+ ]( T/ N, G" S, q" o emailerr=emailerr+1
$ r$ B2 m& H6 F7 g, R1 D } & S2 H4 s9 h# [5 H, e1 b/ }
}
/ B% E+ w( X4 T) e if (emailerr != 1) 8 ^; {! F" `8 B. y7 Z; x7 @: h2 _! J
{ 6 a/ I* V. @# r: O6 s6 s/ q
alert("请输入正确的E-MAIL地址");
4 I9 ^, x- T: b8 V V9 E document.sform1.email.focus();
% N- X& R; _0 a: E return false;
u- c" }9 x7 h# ^8 m3 j3 h } 1 N) o5 c W. {6 v0 D
+ S% a$ h# {0 \% v' o
if (document.sform1.checkask.value=="") 1 G" K, \) a* ^$ v0 B8 }5 b8 k
{
& p& T& ^2 s2 ?$ @ alert("密码提示问题不能为空");
: @* E+ k) s8 u$ l/ w1 q: E document.sform1.checkask.focus(); 7 S. Y1 a0 \ b% S7 V
return false; + G/ g0 P B6 h* X- Y1 N! m
}
1 u5 a( ]1 U$ f L7 t if (document.sform1.checkans.value=="") 0 `6 u% ]2 j( W5 a+ T0 U
{
/ d- J5 q& t5 B" W, J alert("您的密码提示问题答案不能为空");
$ Y( K0 a1 Z, X' ~! ] p* S) m document.sform1.checkans.focus(); , ~9 q/ N- R' N
return false; 6 O. V. {3 L6 B: q1 P. }! r
}
* o# q: b5 e) k" G5 k9 c$ t6 I) t return true; ' _! U6 U# R; }6 J/ S& Q
+ _/ ]/ m8 i" ?
} # o# N0 T6 S; N ? `# D; p8 d4 w
</script> |
|