|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14399
- 金币
- 2485
- 威望
- 1647
- 贡献
- 1433
|
这个脚本对你可能有帮助:/ d1 e6 I6 r" w9 A8 ?: s( U# s: t3 p
<script language="javascript">
5 O" p, {& t; T0 S( ]2 k5 nfunction IsDigit(cCheck)
; x" ~/ F5 D: B- i { $ u4 h0 x* g0 X
return (('0'<=cCheck) && (cCheck<='9'));
5 K0 n; u' ^2 d! } }
) c4 B% @' `7 }% X) v; a! _ ) I2 V1 E/ u1 c" l+ i
function IsAlpha(cCheck) ! Z$ }8 m' A! }# [$ z
{
! z5 k- i Q. I$ K# f return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ( n. W+ m0 D* L& t
}
. [$ u% [: R+ R6 l% {) Q. [! g
" H. Z7 F# k; F* nfunction IsaNull(cCheck) 1 ^9 _* r- i, S1 p
{
; o% M7 d& V' s return(cCheck != " ")
1 x5 r# o# P% N+ \6 R$ i0 [! W5 L } 6 }' R. e h6 {/ z4 F ]6 v
3 n$ z- S: y- g2 S H) gfunction checkform()
, L9 i, d! U4 c{
! }5 S" g3 U) M9 p id = document.sform1.id.value; . X6 c6 y' C& n8 n! X3 f
if (id == "")
1 q2 s$ A4 t+ W# K { ( ]/ g% ?; i \" ^
alert("请输入注册名");
' l) R# S; m' }: H) l' l6 S1 ~ document.sform1.id.focus();
/ g" l! m, O5 i7 `8 k% T+ [# m return false; , {0 K, Z. v8 X a% W' g; S
} ' |: L) F6 Y2 X: W" O
. J I2 \+ L7 c7 r( f2 `
for (nIndex=0; nIndex<id.length; nIndex++)
# z! Y6 }/ w6 V0 k) H1 N {
/ v) n+ q# ]. t s7 q' v cCheck = id.charAt(nIndex);
$ i0 q- W, K0 S0 D' _) r if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 9 q0 s& y( u7 v$ v8 d
{
! l. l+ K$ N" N$ u7 b8 k alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * Y9 ~! X% |: y: @; e
document.sform1.id.focus(); * ^ C' D2 c7 R) T
return false; 9 {. y( @- r. z) A* X# h9 |
} . H. m/ A. x. |1 C
} y1 S4 L6 l7 x$ o+ T9 k, ]
chineseid = document.sform1.chineseid.value; 8 I$ y" v/ I2 B1 v& i9 ]
if (chineseid == "")
" Z5 q1 }$ H% D( K: u7 O { 6 g4 F/ o- D2 w2 Y
alert("请输入中文昵称");
. u- P) S o! n document.sform1.chineseid.focus(); # f6 t' H- c+ a0 b N2 W
return false;
/ T& ]6 R' ]1 t } . k4 o4 G) z0 a; y
password = document.sform1.password.value; # q$ z2 I7 V. J- d; R9 B
if (password == "") 5 F- [% |5 O3 Z6 }$ _
{ ) w* c s2 e8 P7 @: X
alert("请输入登陆密码"); ) Z+ B# B) Q; X
document.sform1.password.focus();
6 [& R" k, _1 M' H' s return false;
/ |6 T0 T) G; i. V* g8 I1 T- H& [3 G }
8 Y. [9 u! T3 g) r: F# z3 W$ f3 q password1 = document.sform1.password1.value;
8 o6 P! z0 n1 ], n8 g if (password>password1) 1 D3 l- A- ?" H
{1 a" A* C4 t1 }1 V
alert("重复密码与登陆密码不相同");
# W+ _. [6 F) Q" S document.sform1.password.focus();
. ^ W$ ~ _6 Q9 R/ K8 p, ? document.sform1.password1.focus(); . ^ A* w7 F0 ]! Z6 C
return false;
! O3 d9 B! N. R } _2 }$ e+ |0 @; ~% F
if (password<password1)
7 M- n# {0 v* T; y7 A' j# C4 Y5 v {7 A. [& R/ |, Z* M% ^, V
alert("重复密码与登陆密码不相同");
! N) o, [% I# ~; {; p7 i9 W document.sform1.password.focus();
/ ?9 F, ~2 A2 V9 d. | document.sform1.password1.focus(); : M( g5 N4 q6 X8 h
return false;8 H' h- d: o8 n( O: A
}
$ _- }/ t4 U' ]6 |* k9 E5 A if (document.sform1.email.value == "") * A; y) k$ _ P9 M4 V" |! f/ v. ~
{ 9 p* G& F# L* t; A: G9 I" |4 M
alert("请输入您的E-MAIL地址"); 0 [% s3 g4 e9 l
document.sform1.email.focus();
$ D2 O2 ~9 [. O0 o+ C return false; U% b5 ?8 g4 L8 o( ^
} 7 T. L- s& ]) [, v: _7 f8 y
|; g1 J4 [/ A4 E email=document.sform1.email.value;
- w: R8 q* s- W p6 a; ] emailerr=0
; U+ x, _9 y1 `4 B i3 ] for (i=0; i<email.length; i++)
' }9 b5 T3 v( J/ Y9 Q7 p% l* x- U {
+ r5 \0 w. J; i+ |! L if ((email.charAt(i) == "@") & (email.length > 5))
2 A7 p" g, ^9 T% t' ]; W: \ {
/ V/ `: c, \3 M$ R6 D emailerr=emailerr+1
5 m7 W+ }: ^; N% ^, M; N1 V }
4 o, C$ C7 ^9 y9 g) M4 Q } 0 m, n# G( l& Y# |7 W
if (emailerr != 1)
3 D$ l( R% Z$ V( I* u* _7 R { & e4 P c8 k9 U: |8 z3 }3 [
alert("请输入正确的E-MAIL地址"); ' ?3 D( h# E! O% e
document.sform1.email.focus();
$ W3 w7 a+ x) x+ Y- R& ^ return false;
0 x; w M! Z, `6 c' K \ } * j% l% }2 D h# ~$ G
+ _- l4 T2 q# ?4 ]1 o
if (document.sform1.checkask.value=="")
$ k. z, n4 A" A/ [% ?% V @) U {
5 d2 b5 Z! ?; @ alert("密码提示问题不能为空"); . t* m- h: l- N- ^+ h
document.sform1.checkask.focus(); . \6 E' w, r( N G& j$ H5 Y* d
return false;
* m6 D [# ^) F }
" C4 `; \) s2 }! Q0 c$ M5 l( ~ if (document.sform1.checkans.value=="")
5 M) ?; \" e" [4 I9 F5 j { `1 V* u0 |8 y" o5 p
alert("您的密码提示问题答案不能为空");
7 M, J: e; D5 k1 h5 D% ?6 ~ document.sform1.checkans.focus();
" k, @# z/ P, a1 y9 O. ~# ^3 d return false;
. e4 }* \7 H0 q# q }
/ a& {# ]7 p! g9 I return true; * {' x" O9 s0 Q9 y# f, D" z. K
0 \. }. S6 `9 P9 G) D* H- O
}
. L: u# d( ?2 s" c+ A3 F</script> |
|