|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:! f3 D% V# g- h2 C( D+ r7 c' Z+ y
<script language="javascript"> - F# @0 _9 ]$ [
function IsDigit(cCheck)
" G7 K8 |6 x0 w: `8 Y { . Z/ g0 p4 A! L9 t
return (('0'<=cCheck) && (cCheck<='9'));
8 i% l7 r+ d6 i* G7 U- C S } . Y- W- R9 d! F! R
& F% @ C E- B: |6 r
function IsAlpha(cCheck)
. Z4 P1 x& R2 s- ` { 0 O1 o/ i! r3 j/ A4 D1 [6 D
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
/ D7 k& r; D! _+ V4 m }
r: W6 i# |' l" e. j. z * q; n7 g& r( ?( r2 S
function IsaNull(cCheck)
' L2 D: s' W) ] j {
( g% ~( |! S3 b2 O8 ^ return(cCheck != " ") 3 I1 H' k) n0 q
}
/ F9 Q; g' }; b3 @3 l1 h % n& {! F, z$ N& H3 _2 Z8 q& m
function checkform()
! G6 r1 z6 e5 G5 t( ~{ / h) q- }2 @% k! K2 i$ ~
id = document.sform1.id.value; * H& V8 C, |. ^# q
if (id == "") & k4 n. C* p& z) j" {: r
{
5 {& X! K' ^+ \3 a3 n1 z alert("请输入注册名"); ) w% [2 V! o2 d4 f
document.sform1.id.focus(); ! N/ H$ }; y2 K' U) z9 H' O' o
return false; 8 I# n( I8 ?% ~8 z
}
8 N, u' t* ~6 A
1 v6 _. j4 H+ C$ \7 E l8 U for (nIndex=0; nIndex<id.length; nIndex++)
5 R4 O$ V9 `: k( B. T {
* N5 |# f4 D% X cCheck = id.charAt(nIndex); 3 X: O! ~: y% D9 F
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 2 L& w$ G2 g5 A0 }, G1 F- |1 b0 z/ L: y
{ % o" ]2 N' v$ Y ]9 K6 w4 }
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
( a4 ?! c. i8 ]' n document.sform1.id.focus();
3 n4 _: u) Q7 W8 b return false;
g3 A5 E# A% {1 w; z1 ~ } - K5 I$ ]% W1 t, G3 ?5 x& P/ u
} 9 m( x) R! N4 C s
chineseid = document.sform1.chineseid.value; 7 b$ F, ?4 Z' H% w, {
if (chineseid == "") ; e$ h3 Z9 _# D5 t( e- w$ n
{ ' M: d9 z- L+ D0 j1 {0 Q
alert("请输入中文昵称");
) z& k& Y* N1 G document.sform1.chineseid.focus();
9 B2 q5 y& V: \( K0 J return false;
' t. o* d1 o4 _+ U# Y5 y' H) A& R }
4 y+ a; Y) M% E+ v4 X) {- ?; C" z password = document.sform1.password.value; % _& B! C H8 z* X! U3 F
if (password == "") 6 y+ o4 a/ u7 }' c' e: n
{ 7 _' L9 V3 Q& k3 S7 E. I
alert("请输入登陆密码"); 1 ^. s- d; K2 X
document.sform1.password.focus();
4 m4 x, \- o& |" b7 S# n return false;
* c$ Z1 ]9 L: ]2 Z5 @2 p } : ]' O, R2 E/ [) k0 E, F
password1 = document.sform1.password1.value;
; r' Y" e5 S! s$ E if (password>password1) ' g4 R4 V* |2 E0 L I) y
{
% W4 b4 W; e( S ]/ j* H9 _$ J7 B alert("重复密码与登陆密码不相同"); 3 `( D9 }9 B' M- X! L
document.sform1.password.focus(); 2 g |* B5 v) |8 `
document.sform1.password1.focus(); * P( E$ L: }6 g4 m3 W' p. z) c9 t
return false;
% z, l+ t1 k/ }# A- ? }
3 Y6 X+ L3 N- d: g1 wif (password<password1) 9 O8 V, {; @, C8 w
{
/ I) A' N& r: Z% Z6 G alert("重复密码与登陆密码不相同");
/ S' Z, D% k, T ^- E7 K% T- I8 R$ B document.sform1.password.focus(); ! {0 F3 z' f6 i3 h1 {+ a
document.sform1.password1.focus(); 9 Z* l4 Q; V8 X
return false;; x( d! N# c3 ]9 P \2 Y) J
}
% u( a$ v4 ^: y5 V5 @ if (document.sform1.email.value == "")
r# P8 e' J, F { - A5 b+ s- b: ~! i" |4 Z# {
alert("请输入您的E-MAIL地址"); 1 c) N {' _ ]! X6 E
document.sform1.email.focus(); # g3 F" r. l) ~9 a4 \# T' Y- d/ W
return false; 3 ^" `5 X" D9 t0 \7 k F
} / O* g$ m1 g% x5 n# O6 p I
# n. t- H& I1 p$ r9 z5 a email=document.sform1.email.value; f9 H2 |* t* e/ ]; u1 g1 S$ V5 J
emailerr=0 ! `' _# t/ ]6 e3 a
for (i=0; i<email.length; i++)
5 e0 P4 F: x' r, j0 |6 H {
9 G! x' S/ g: J/ Q if ((email.charAt(i) == "@") & (email.length > 5)) 1 G8 Y: v8 g6 O8 l9 L
{ - m8 `5 I* T6 z9 i3 h4 \
emailerr=emailerr+1
/ ?* E2 `" Z8 J4 m5 ?2 x } ! O1 z: L1 Z" L& n0 i% s
}
/ t; Z, v% i R. } if (emailerr != 1)
" T/ g4 W8 |$ | { + V" g! S9 ?! G8 b- i- m
alert("请输入正确的E-MAIL地址"); 1 z6 x+ l: n' C. C# _ w0 y
document.sform1.email.focus();
9 m# ~" D3 T. l! T. l return false; ) r9 U! D# Q# U! i/ d) `
}
' l( _0 ?# f# I! v# m / r9 P$ d, |( i% i
if (document.sform1.checkask.value=="") 8 H5 E8 k) j7 q7 Z0 u' B
{ ' R9 T- `' m( k, g4 w1 h
alert("密码提示问题不能为空");
: R: Q# X. M0 n! R6 K, L2 d; [! E document.sform1.checkask.focus();
; k1 l& _/ ]! t! q( f' s) b& F* R return false; / z9 ?. D: A0 k: j _+ I( N
} 9 b$ N- F8 H! m8 C2 v
if (document.sform1.checkans.value=="")
. p( m. G$ ]2 \/ m { 4 c* s% w1 X" U5 j
alert("您的密码提示问题答案不能为空");
8 f9 g6 g0 ?: y8 f$ x; R; h0 R document.sform1.checkans.focus();
- {- N( e$ T8 z/ U7 F% Q return false;
) b. g1 h5 A' h0 L }
& x8 o2 w- P# l/ U6 w8 x return true; N; Y6 X N) M% B( ]
" w0 B& ~3 t7 A/ y I3 f. E} ; m: m4 c+ ~% ^7 W+ S
</script> |
|