|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14381
- 金币
- 2476
- 威望
- 1647
- 贡献
- 1424
|
这个脚本对你可能有帮助:& @3 P: O/ u" l# I# p
<script language="javascript"> % r! Y) Z- G, C7 c4 Q
function IsDigit(cCheck)
- A8 @: W9 q$ i- i8 | { ) y$ N1 ?2 y& v5 _% {- P ^2 v
return (('0'<=cCheck) && (cCheck<='9')); ; s! r' x" g K4 n5 W* l
}
6 U7 W, ~1 w9 Q, q. G: H4 {2 L5 u ' a3 N. ~) M* T7 m9 b* P' A7 m, t- U
function IsAlpha(cCheck)
- l! [" S8 f7 n4 i/ v) q {
9 T6 z, o2 l6 d5 w0 q( ?( i6 x return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) & D0 A" b a, a: K7 z9 {; y
} % R( k! B2 C& O" z
0 k7 x2 C3 V5 ~/ ofunction IsaNull(cCheck)
' `5 U; f5 x- w2 s7 E& k {
: h) V. ]. T6 }/ W6 h return(cCheck != " ")
* v# w/ c* L* O% F5 S) A9 ` } / E& }4 b& {8 Y" C4 M/ ~
0 h$ B! g; |. b, V6 ]5 ?
function checkform() * m, h1 n, t J# g
{
- [4 B' o3 E+ |& n id = document.sform1.id.value; 6 W6 o: @" e$ @7 w: o0 q" A
if (id == "") - X9 D! l# H# y; S1 x! f/ d
{
1 S0 e l4 x, E* E$ Q0 m2 t alert("请输入注册名"); 8 `# V" \, i1 p/ k$ U- S
document.sform1.id.focus(); : V5 P5 L1 O. [+ t' N: W" G
return false;
% j' R2 }: K7 S/ N' c2 e7 w% w# H' o }
+ @/ a7 F, L0 r9 B/ b& q
9 C9 a D3 `% p+ P for (nIndex=0; nIndex<id.length; nIndex++)
1 O5 J- L2 M" o& u$ { {
( E, l& d9 S& _7 V# O cCheck = id.charAt(nIndex); & }1 a* q3 u+ m/ n2 X. }9 Z* t
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
) Y" G. p$ p' Z: L {
. _" m$ _* f( j alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 2 n" O+ x& N" X) q! v) c6 C4 h
document.sform1.id.focus();
% T$ u8 ~! u h0 e& G' c$ U4 ~ return false;
1 p: L& [- x @ } " p4 Y$ h9 |1 g: w4 ?
} - x! ?2 i$ h1 Y+ K* _
chineseid = document.sform1.chineseid.value; + e* P2 T/ s! F9 ~$ f
if (chineseid == "") 6 U! H5 Z* Y, x o3 c5 m
{
( x& G" Y3 K& g% { alert("请输入中文昵称"); 0 i& q/ P1 {" s4 Y: t% A* q4 j8 R
document.sform1.chineseid.focus(); 2 c( j7 y/ O# w
return false;
- D" }2 _4 [1 p w$ b }
. |, i+ e: ?) ^* h8 q) a password = document.sform1.password.value;
! X0 x9 H( G9 U3 i0 r if (password == "") " z8 P. }# f$ e) k# P: o4 A' d3 P/ z
{ 9 E+ j$ |* M1 `" [! O
alert("请输入登陆密码");
) H' F! D* ~$ k J g document.sform1.password.focus(); m4 ]3 n* n9 o% v$ T
return false; I5 e/ n6 } {# H3 |
} ! z( _ P) j- c3 M' Z0 T8 `
password1 = document.sform1.password1.value; 5 M$ T0 H2 b9 Y5 N4 u
if (password>password1)
O/ ^2 q W" g" m. w0 c9 s8 w {% H( t% y# `% y0 R6 `* V& L
alert("重复密码与登陆密码不相同");
% F: @ C. D6 E, o document.sform1.password.focus(); + ?+ [" p4 w' Z- }& Z2 a2 w% z) G1 C" `& `
document.sform1.password1.focus();
+ B9 }7 ^! S8 i0 W% o S return false;( X# N4 x1 T. |$ w* o: L. W
} , e. |3 s5 L6 a' D
if (password<password1) 0 ?" u/ t I y! K, o, f! V- }$ S
{; S/ h @$ w4 H* z m3 w/ I6 \; e/ Z0 I
alert("重复密码与登陆密码不相同");
. n# t$ ^1 ?( Z. C document.sform1.password.focus();
% x1 l# }; s# \4 ? document.sform1.password1.focus(); , Y3 [8 u! t7 N7 E6 C7 h
return false;
3 q b9 c5 P$ n9 u+ k; ~( K2 H, o4 E }
1 y6 u; C. L9 _/ V9 q# s if (document.sform1.email.value == "")
`( G. Y+ M% F2 Z" `1 g0 A { / m# a6 t/ ~2 t1 h
alert("请输入您的E-MAIL地址");
9 k& N1 Q4 E6 c8 U8 } document.sform1.email.focus();
5 M% G1 Z; v9 U' y3 H2 T' E return false; 7 {/ }( R" e# ^2 ^+ y% O1 k
}
$ J! h! O3 u* C' @* F4 @6 y
: v2 [7 K7 ~! O9 _4 V email=document.sform1.email.value; 7 g5 j! @* x' K5 f* i
emailerr=0
9 D* p2 ]. Q% p+ p( @6 [ }; b for (i=0; i<email.length; i++)
8 `" ?1 W' P: j. a {
) V& v8 B! ]4 {! x. ?+ I) [7 D if ((email.charAt(i) == "@") & (email.length > 5)) y( o. q% W1 `% T, N
{ 3 A) f. o( T2 q5 L
emailerr=emailerr+1
, T7 ~( N. ?) i: b }
$ g- X# L3 R& \$ p- v1 H, } }
8 B- e/ P6 L% ^& i if (emailerr != 1)
5 p+ w# x: V3 D; ~ {
2 w4 P# E* u2 U! E- f. n% ^) d alert("请输入正确的E-MAIL地址"); : A- x. t0 P8 A1 ?. V
document.sform1.email.focus(); 4 l: j' U+ F) D2 ?% o
return false; " s9 k( r6 l0 E4 _& v
}
# J; [6 w: l3 l% d8 s) n: h; T: E + c. `1 R" W2 `3 |5 [9 W8 E
if (document.sform1.checkask.value=="") " E9 r. T4 H, i. `9 y
{
# ?( O6 S) t+ i5 t6 S alert("密码提示问题不能为空"); , I- r: J( Q8 ^7 p* C+ x
document.sform1.checkask.focus();
) u9 \3 \; Q) Z7 y: l8 q6 t# a7 x return false; 9 }# W3 J5 o7 ~$ G5 [
}
' p$ r+ D9 Y) N$ J9 T8 c( G O if (document.sform1.checkans.value=="")
, ?5 Y. N1 A9 I" J% G; F; m {
( h0 B1 ~* G& f) }, t5 _, Y alert("您的密码提示问题答案不能为空"); 3 Z* O, f# z, {: r8 u% R- s: D9 O: N/ u
document.sform1.checkans.focus();
9 @5 F6 d- Z* C8 W/ }! w8 n return false; & K: L/ a( T* ]
}4 B$ N- w9 `" C2 n/ e
return true;
, z3 B% l1 O$ W8 z2 B; E \' a9 ` 9 @" H$ _+ k' x- |2 ?* W8 g
} 5 c: I2 m( F6 F/ z ]6 O
</script> |
|