|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14347
- 金币
- 2459
- 威望
- 1647
- 贡献
- 1407
|
这个脚本对你可能有帮助:7 O. F1 t0 L( A- z
<script language="javascript">
1 l4 V+ Z& c- o8 r; q% s& wfunction IsDigit(cCheck) - X5 G# M! v) T, n! e" R7 |+ f
{
. A5 O9 v ?6 e- s. C- V: @ return (('0'<=cCheck) && (cCheck<='9')); : U) o( @% E' N$ o8 m
} # o/ Y, s$ ?2 [/ P7 R% Q
% M7 M, ?, ~, @/ M! |# @function IsAlpha(cCheck) 6 }$ N2 c4 s% x- @$ x9 A, N1 S9 s) H
{
2 ^: H, P. ?, j+ ?% D return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% ?( g/ e0 W. ` }
4 J* h" A$ Y' S1 p# n2 o
4 M5 y+ V `5 ?function IsaNull(cCheck) . l t, h! N0 z1 _7 V9 F1 q! @- T1 U
{
% \% `3 ?% A( X) {- M return(cCheck != " ")
4 d- V5 K$ K+ P3 t' s/ { u }
# c- v. z( F5 t% O & n% U" M/ {. C N( d [
function checkform()
w& ]+ p/ ]" e+ ]1 ~$ V{
+ a- i" g- F; X id = document.sform1.id.value; 0 q2 r% a" T/ F% E3 m
if (id == "")
* J6 T, c5 N9 d0 G s. e6 }0 a {
# Y; U0 V! Z7 f C- k# D7 `3 e alert("请输入注册名");
. ^$ T3 v8 ]4 V, W* o3 g7 @9 q3 g$ y document.sform1.id.focus();
6 A8 V8 W) A& F2 x* } N. H/ u return false;
|' Z% p8 t& G6 u/ H+ W6 j. \ }
4 W; B" c4 g4 K0 E! X# u ) r1 D2 ]; I" Z4 n1 n# c- S
for (nIndex=0; nIndex<id.length; nIndex++)
/ i' t: |9 C8 [) t { * J$ s& }9 A! D$ W7 }' }) i
cCheck = id.charAt(nIndex);
/ q7 x( g" @8 K+ a4 Z if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! |; T; _% E2 I) o4 i+ O8 O
{
+ g4 g" |, F8 l) K5 b I alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
2 @6 n# q+ z9 t) {. N! u document.sform1.id.focus(); U- X" A! @* x c
return false;
; u2 b9 o' F0 x- x3 q } ; ]7 x/ b3 v; t: P% _
}
! N2 j5 ]- j5 q( R chineseid = document.sform1.chineseid.value;
# N4 D# Z+ ]/ P if (chineseid == "")
5 @5 u0 e; g \. t! t( _ { 7 N \7 N" U, y) }8 V8 [4 L
alert("请输入中文昵称"); 8 C( U2 {6 z% l9 i' p5 X# ^. w6 K- ?
document.sform1.chineseid.focus(); 7 `8 S* X8 X4 x/ t( p P
return false;
( V& o3 g! z2 e/ {2 r } 5 A( _+ X. {" I6 C
password = document.sform1.password.value;
- e9 ?6 S" B4 B' | ` if (password == "") ) n/ Y% G) W6 t7 Q, _5 [
{
! c- G* J! ^* f" s# F: J: U, C alert("请输入登陆密码");
4 g, g' ^% [; r" w6 h0 \0 F. @/ M; M5 e document.sform1.password.focus();
: Z4 j! ^+ G" Y# @ K6 D! x+ G7 ? return false; " J% i9 U, Y# t8 S" ^8 t
}
- I b" z2 Q0 r4 e z6 I+ n password1 = document.sform1.password1.value;
0 j5 f2 T$ Y8 i) ?, f: x/ A if (password>password1) - }2 n3 S3 f! L0 U
{
+ w3 e+ z" n- j# B alert("重复密码与登陆密码不相同"); . F G E" x2 o. r- v. I
document.sform1.password.focus();
; d5 l9 P3 m/ v0 @ j* \ document.sform1.password1.focus();
" m0 J$ L- y# R ~2 O1 L/ K' P return false;* W2 A D& Q* J# U
} ; [# f. F! o7 G% r
if (password<password1)
7 |' S; T) g5 K( B {' A+ L/ w l8 R$ h9 L( ^
alert("重复密码与登陆密码不相同"); , G# i/ x2 w2 A# X5 e
document.sform1.password.focus();
1 I* B" M6 N% Y" k document.sform1.password1.focus();
( x, h0 E4 ]! M4 R' o6 q' y return false;
" }( b$ w: l/ N1 M- b9 r } % x O% a8 c* Q% r
if (document.sform1.email.value == "")
+ Y; Y9 b# Q3 A2 L: c: u: ]+ r {
9 B# r5 B6 H, h alert("请输入您的E-MAIL地址"); 8 s* }$ W% W, H+ ]- C9 ^
document.sform1.email.focus();
% _3 Y3 }& c) |$ k$ s return false; % Z }: [6 s& \- i; [# H
} # j5 |% y0 O' X9 \2 G+ c) L
7 w: Y: p G- x! I# o% q email=document.sform1.email.value;
) d# Q/ a M4 S1 j3 ~& Y emailerr=0
! r6 s) |! q( R for (i=0; i<email.length; i++)
. `6 S) y7 w6 u; H7 y { " U$ l$ [# A) P" c# D/ |% d
if ((email.charAt(i) == "@") & (email.length > 5)) s) f: u( f3 J; X9 U
{
6 ^1 H7 q) l. w+ X- ^, N- }) g- D emailerr=emailerr+1
. z9 m: h: S0 m& d; m } 9 B; j5 m4 }8 V$ T3 p/ w
}
7 _& h/ ^& v+ i+ n/ F& Z if (emailerr != 1)
# J1 `1 w; Z2 u) f0 \0 q) v { 0 {3 `/ S' j, g8 e" d b1 L9 ^
alert("请输入正确的E-MAIL地址"); / ]9 Z1 H- Y# }/ M5 l# F! D
document.sform1.email.focus();
; d8 V. a! S. q k4 Z- R1 w return false;
6 g- X7 A. o9 s2 I% g" }/ H } ; _7 ?# H K( [0 x. T& \
- `# g' Y/ j# c! v+ t
if (document.sform1.checkask.value=="")
, ^' S5 f2 G) \. R% X { ; q& H1 C$ T) D# K6 ^8 O) j
alert("密码提示问题不能为空");
; w) Q$ \, Z$ g% j4 y9 J5 K document.sform1.checkask.focus(); * E. l& g! z4 J4 X' @7 I
return false;
5 E& ~. X, K+ J* w } % Z4 P9 w5 l6 b( q- @: h* ^
if (document.sform1.checkans.value=="") $ S% T) [& H0 v* q8 @" H6 G
{
: X; P+ U @% u' P! M alert("您的密码提示问题答案不能为空");
) W. H! ^5 T! ]$ V, Q! Y document.sform1.checkans.focus(); , X0 {% p: J% O
return false; ' m$ x" D$ z$ V- C5 [) M) u
}' L+ H0 [8 s" b0 t
return true;
: u" s0 N& z+ a+ n, \8 N8 z K " D6 \+ }" \3 O0 ~; {
}
) Q- L* t7 W( ^* k: q. {# ]) ]: n</script> |
|