  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:
0 O1 b% |* g0 `0 @( k<script language="javascript">
+ m( z# `$ c ~. R& I& Lfunction IsDigit(cCheck)
# b( ^& _- b+ @* k' u- y { 1 s- \, A ^6 ?4 ?. n6 n, P
return (('0'<=cCheck) && (cCheck<='9')); ; B; c' p( ?8 W1 ?, J1 \; H6 I
} 4 s: S4 E9 s6 n2 X# x6 H; Y
2 p% y7 E% I- ]0 \) r+ cfunction IsAlpha(cCheck)
7 x; |7 ~% c! G% ] {
. T. Z+ _7 j! a n, q& o3 i7 C8 }; i return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 6 ^% f6 F: B' W: ?: W) i( T9 [
}
l+ B; ~: r. P2 a9 M2 y
9 V4 F/ _' @0 @' f% U8 rfunction IsaNull(cCheck) : ]3 t6 y' E3 F1 k
{
( o9 p) d8 B! b+ q# T# y1 R return(cCheck != " ")
2 [" P2 c2 T9 d" s9 D4 l: [ }
& h" R& @- U$ [8 ^ - J* P; e3 R( t" j' `
function checkform()
H# u& |/ ? X) w; S{
! {# S3 J/ X' F# I" B) Z id = document.sform1.id.value; : z/ W3 l. @7 j" a( m5 m8 g* [
if (id == "")
C2 Y; Z3 V" I {
2 B' Y7 a O' Q. i alert("请输入注册名"); 1 T3 D. g, v& Z
document.sform1.id.focus(); 3 Z# k. l1 w$ F1 `( ^
return false; $ q' j. m* y$ F6 w; o
} 0 R8 x% _0 y' X _7 \
X k% V. _+ u# }7 X& `
for (nIndex=0; nIndex<id.length; nIndex++)
% Q) n& X) K6 x' A( S4 A { + M' |, A- t& Z; W- [# R% Y' B
cCheck = id.charAt(nIndex); * a; I% t, }8 G( G a0 [9 O
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
8 q7 R) b, Q4 M& T" l" W {
0 R3 b# |1 L# c! }8 B& ` alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
# S- D4 A9 I4 d9 U+ o document.sform1.id.focus(); 0 U* A7 B; l8 |& x$ D$ [
return false;
) D* s2 I/ F% g' l6 W }
: |" _; e% d) w- Q m/ T" E+ R }
V8 T7 [. P2 S2 o chineseid = document.sform1.chineseid.value; ! P: J: T; i1 O
if (chineseid == "") 0 R/ j( G9 m- y* |
{
m. b# p: M4 W3 Q* T1 M% l alert("请输入中文昵称"); : s3 f( ?( U5 z" ^5 J# g0 d# ~
document.sform1.chineseid.focus();
4 z0 Z! ` y0 C9 J$ ?! i return false;
/ V2 g3 h: [; y, C }
1 B6 _' e7 R7 o5 Q8 O/ K, i password = document.sform1.password.value; & p4 d2 B, E( u* A
if (password == "")
- j+ j; O8 Q m E ] { 0 D. S) c, j$ t) ? x1 u) ~0 X
alert("请输入登陆密码"); ) q i" n. }' t' m6 t; f, ]
document.sform1.password.focus(); + G! h& }" c- a b9 N; k4 ^( e
return false; 3 ^% C4 F$ J" L3 w# k, X
} 4 \% q! |( P8 k( P$ n y$ \) P- m F
password1 = document.sform1.password1.value;
; M3 p3 {. t4 j% x, ^; G if (password>password1) 9 c$ }* J0 _+ p, P, Y# |$ s
{
& M( _, m1 Z H8 }5 G4 |- R4 p4 P alert("重复密码与登陆密码不相同");
" O* h* C' N- M document.sform1.password.focus(); + S: ?) n/ s, t" l. O* I+ \
document.sform1.password1.focus(); * H3 W4 {5 Q" b
return false;9 U+ ^2 `. f& u4 c. M0 s
} ! z1 m% I) y9 h! d$ K' H7 {
if (password<password1)
! W6 O z0 @6 }8 V0 t {
" }% Q3 o& N7 C- u2 a' l alert("重复密码与登陆密码不相同"); # o7 m# w" M0 ]" \- ?
document.sform1.password.focus();
. h; {4 } c% c$ \! W6 ~ document.sform1.password1.focus(); . A3 k( M% B+ _1 Y! {2 B" Z
return false;
! h; k5 v9 k6 P" v# e$ w. N! X' z; m$ E4 Q }
7 q0 M8 |6 a5 ]( B+ N, R if (document.sform1.email.value == "")
# D' j5 i% s& P5 R { , T- a8 x+ M4 D% @9 c
alert("请输入您的E-MAIL地址"); 1 t" ]! j& u8 [ a) c2 ]
document.sform1.email.focus(); 6 G. J% \7 r& B9 p* v
return false;
8 l6 R( f/ n% C2 f }
) Y- z( C& \/ M) k, K0 @/ X
9 X9 p* I. m7 @+ }2 P9 @# ~' _5 g email=document.sform1.email.value;
' n9 n/ I! s7 X: |% U emailerr=0 , m/ `& k" u! y& H! j
for (i=0; i<email.length; i++)
/ F$ h0 y; d/ v! C9 |7 o r- j {
- w' h* }4 }9 i( j6 w if ((email.charAt(i) == "@") & (email.length > 5))
% N2 ~$ W* e4 Y, a8 ?9 O { & \. n, d. n) N& ]% T2 N
emailerr=emailerr+1 , K7 @% [6 v1 E) R
} ) a% t* M- ?* j
}
# @& u P4 r$ o% c O. } if (emailerr != 1)
# g+ W$ L [" [1 T g7 B9 _1 Q& z { 2 T7 B! B% u( G) f+ L* K+ O4 F' _
alert("请输入正确的E-MAIL地址"); % x' k/ E/ c, }
document.sform1.email.focus(); P0 [- E2 O& o
return false;
/ s; l* g2 b! b+ ?7 Y4 Z } " _# ?) U5 ~" g
3 j5 `5 h, l, s9 S$ @# n if (document.sform1.checkask.value=="") ! V) U8 f* N" x1 h4 d; O% i' ?: B
{
( b5 m6 I' Z2 `3 K7 k alert("密码提示问题不能为空"); % ^6 F$ }" w7 P' G4 N4 F
document.sform1.checkask.focus(); + C9 {! j, k, {* K, D2 b; a
return false; ; l7 N, z. ] w8 r1 @
}
# d" x0 s3 Q7 B/ k7 e5 [ if (document.sform1.checkans.value=="")
3 b* b, h* w* p! W( e {
. x2 B5 t3 s G3 q2 g3 h! V alert("您的密码提示问题答案不能为空");
; C4 e D+ i2 r: d( h document.sform1.checkans.focus();
2 c: s& t e) o9 q- e- O( e return false;
9 h6 N1 @7 V- ]7 T3 r& M }
1 R8 U y0 ]+ r/ Z/ f0 v+ Z( [ return true; 6 c) ]& z8 o |) |* a6 s
+ a5 K, T; ]2 l: d0 |0 \
}
$ l' {( Y8 e2 I- _6 m9 `% s8 m' H</script> |
|