|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14429
- 金币
- 2500
- 威望
- 1647
- 贡献
- 1448
|
这个脚本对你可能有帮助:
9 l$ o0 J$ {7 S- Z! c<script language="javascript">
. t! O9 f3 Y e2 l' Q9 ufunction IsDigit(cCheck) ) J# Z9 Z8 X1 I, x- J
{
P7 D6 e1 `, Q! u' [, m& j return (('0'<=cCheck) && (cCheck<='9')); 7 U# ~4 i( Q/ c1 W
} ; Y5 ^& B5 s% _/ K- e
) D7 y3 L3 a4 `! P" R3 ]+ b2 m
function IsAlpha(cCheck)
5 v6 t, w$ W" }0 {. j { , p7 m; r0 e% O! X, {+ O1 h$ r% U; x
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
h# @* P' L# x8 p$ R }
; x; n; ~8 m4 [/ O5 Z
2 w+ B+ s/ t3 V) \; w8 w0 q& hfunction IsaNull(cCheck) ! j9 v9 ?) q# H, Z- C: N4 L
{
; g* x$ c# m7 @1 `. P# }2 N return(cCheck != " ")
/ C1 A' Q/ y4 q6 X1 \* M3 f, }2 D; w }
. C& ^9 }" l6 V
$ ~6 C8 Z2 a4 a$ J: j* ?function checkform() 9 N4 S0 H# X% j) h" o
{
3 g/ M5 i7 m* h- n4 w: ?1 A. ~' o id = document.sform1.id.value;
3 j% X0 ^* Z$ h, G if (id == "") ) L6 V) Z L% K) G5 `
{
6 c- ^ X2 ?* }2 p alert("请输入注册名");
. F" C: G/ ]7 J document.sform1.id.focus();
& h8 l) I( g+ | h5 l return false; - t0 U; ]( n* }7 t' I% H
} & m$ W8 M" Z( G3 Z1 D1 V) H
7 {# v) f. ]9 a, w
for (nIndex=0; nIndex<id.length; nIndex++) 7 p2 |7 W" y4 T9 z' y3 q9 D
{ " j2 y/ a5 H8 l* i7 }* o
cCheck = id.charAt(nIndex); ! e) A$ _! w+ t8 y* H
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
2 O+ W0 z# O, E. A. Z/ i {
. N9 y- L' U5 O& z3 O9 Y9 a% E alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); % ~4 D0 W5 ^7 U3 A6 u6 z
document.sform1.id.focus();
7 i6 H4 T& a' \5 P( r* s return false; 6 H0 _. }1 R$ w4 R7 L6 o7 e/ J
}
' I K; x* B# m# B9 d, X }
& d( Y( G$ Y' p3 m2 U$ F a" C chineseid = document.sform1.chineseid.value;
! {& P8 u# t% i if (chineseid == "")
9 i' [$ J, o" r {
! e9 u4 Y5 c8 d( L$ O/ @ alert("请输入中文昵称"); G G' ?9 R, z9 i. Z9 B) s
document.sform1.chineseid.focus();
0 N, m6 o B8 ~6 h* { return false; % {! |+ ?+ H- B) D, _2 P0 x
}
, |; U3 l/ F8 A password = document.sform1.password.value; : O4 ^ X# s0 B& n5 P) ~
if (password == "") 9 [6 F; o4 q" W
{
8 ^9 }3 B% E' M2 E" _ alert("请输入登陆密码"); ; t& x" l$ G! D) Z, F& f5 T
document.sform1.password.focus(); ) B; } G: A1 `. ?' k& P
return false; ' Y" ~$ z5 Q, ]) Z1 H9 |1 R
}
7 _' y5 b4 K1 x( w) A4 a password1 = document.sform1.password1.value; ' E4 p/ p6 o, `5 o$ c
if (password>password1)
: i. i- ]& Y6 ?, u l# _: \( m {* z6 A8 f# S. e
alert("重复密码与登陆密码不相同"); * @. u1 I- i3 n2 H
document.sform1.password.focus();
2 m e( x6 A, s& R document.sform1.password1.focus(); ' n" \( ^+ p1 A' l W
return false;
8 J* A, q7 `8 F: k }
: w- t- |9 E/ X( E# j8 k/ G eif (password<password1) 4 [8 G* f) L/ ]9 U6 X* W: J. R
{8 Q. ^. ~8 }) h' ?0 M& A
alert("重复密码与登陆密码不相同");
3 ]# s4 `% F- x5 Z6 R/ d document.sform1.password.focus(); $ l' v. n' H( f. X5 A
document.sform1.password1.focus();
6 v* d( ?; @' I; Z return false;
9 ?& K( E' u* v } " k3 L; Q( u- D2 a* C6 j/ N
if (document.sform1.email.value == "") ) g) Y. p+ Q0 Q8 ?
{
7 L( {' q4 Z0 H( S alert("请输入您的E-MAIL地址"); 8 S/ U# b& d6 `
document.sform1.email.focus(); ; n' E6 Q$ i* [, m
return false;
& [, y5 T2 K- R- C% z }
# Z b. q+ `) [
; k6 Z! K( B2 v( H+ Q email=document.sform1.email.value;
0 f# z8 {3 j; D5 c# l& s emailerr=0
: a m& K$ v# z I* b+ I/ i) V4 ? for (i=0; i<email.length; i++) % M& ]0 B1 T( {, B6 e6 w* q5 `) n1 H
{ ' p" ~' i9 `) f% l7 r8 K
if ((email.charAt(i) == "@") & (email.length > 5))
f7 U, T( u5 A: E- _, k { 3 M. `3 ?7 s1 ~! ?+ B1 U
emailerr=emailerr+1 3 x/ `, o% M j2 I& F1 x& l
} , b' V$ V- I' Y7 _
}
: L4 c: U8 u* N, z* m' K5 g; Y c if (emailerr != 1) ) i0 ]% o, L0 M$ Q
{ $ R" G1 a% P7 k0 z0 R
alert("请输入正确的E-MAIL地址");
/ w) Y3 l2 R: I1 ]3 w document.sform1.email.focus(); / U0 b8 t4 h3 {4 Q4 f
return false; ! U. p" W( r# c* I9 R1 A. B
} : }& I4 I* s2 w! o
3 c: }) D9 ?& `- [0 M5 M if (document.sform1.checkask.value=="")
+ T4 D V; L5 N1 n( o0 a: z; F! j0 p {
. R* L: Z$ {- X- a alert("密码提示问题不能为空"); ) s9 z1 z) E0 r( g) }. y
document.sform1.checkask.focus(); / D3 f* }, b! I, b
return false; * d9 W, K& E/ K, X
}
; e( G$ N# g5 G$ m( u- K if (document.sform1.checkans.value=="")
& D, R' C+ s* k. Z& A* |: q {
% Z: i9 W! Y4 R) M alert("您的密码提示问题答案不能为空"); $ f6 w2 } \ r0 Y
document.sform1.checkans.focus();
3 z9 c J) I9 j" O5 ?) g return false; ! E0 n& B F- i* b. \
}
9 u6 O: `9 Q5 W1 E T0 x return true; 3 O2 w- O; m m# m {* P
/ K0 S" s' i3 j2 R, Z
} + _. K0 q }9 h: w9 X/ a) T3 r: h
</script> |
|