|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:
+ r( |) _$ b8 h4 r( x/ e2 [5 k<script language="javascript"> , v* }7 v5 R( E/ i9 r- \/ _9 @% n
function IsDigit(cCheck) 4 q: t& A& N2 I) q
{
7 T& y) k: w8 D return (('0'<=cCheck) && (cCheck<='9'));
6 N& l/ H+ h2 }2 k$ W }6 w9 }& H } - J0 m& z6 O9 W( A6 r
|! p. e# d- ?+ O4 [
function IsAlpha(cCheck) 1 N% G# a. ?8 g* X- k2 k# e% S3 t
{ ) c9 C; s4 ]/ ]5 L0 ?
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 Q! L$ C$ N# P' s9 @; A0 \; R2 } }
, \2 C! \6 H, c; \5 {2 [ 6 d* y( b7 Q, m
function IsaNull(cCheck)
& ~! m4 m2 E, g# a% l6 R { ) `3 F& C) [7 |. s6 W
return(cCheck != " ") 2 g* j* ?) _; w0 J$ j5 e
} ( Z& n0 O! U1 D2 r( d% e7 Z
& m( i6 J3 j8 k( T
function checkform()
: k' l+ W9 T# J1 S; ~0 m3 Z{ 1 p& v! w3 B; E+ M4 l
id = document.sform1.id.value; / ]4 q# n5 g' z/ k
if (id == "") % [+ |+ u, ^& _. k8 R! Z& i
{ . `' n& e5 V9 H: c r
alert("请输入注册名"); - t. g3 t0 E8 c0 ~
document.sform1.id.focus();
' X$ h! t7 C4 x% B7 X- Y return false;
, f/ C0 Z3 ~$ @1 @/ `5 ` } ' ]# }3 F( L% m5 L# x( ?
$ s4 J8 H% g6 D4 I* @: |0 m- v for (nIndex=0; nIndex<id.length; nIndex++) % A! O" I) F8 `1 S o3 u6 {
{ $ i% x* x( @2 l9 O
cCheck = id.charAt(nIndex);
5 I4 _2 V2 a G% s! q if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 7 u4 c( C! C8 \" ^0 J
{ ! F3 @! q ^6 O3 z' }7 \
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ; w5 a" R. n- c0 @
document.sform1.id.focus(); 1 w! @# r4 x/ j2 ~
return false;
: z1 y, L2 @9 U# W. X% K y- n+ O/ L } , @( H9 [$ l& S, O5 q! x2 _+ y3 f
}
- t9 k. j+ T8 g8 G0 H' R: J chineseid = document.sform1.chineseid.value;
; z4 F e5 s. u# R0 I& c if (chineseid == "")
6 O X1 i3 H. E d& Y: {" x {
) x: ~; Y/ l8 y& N alert("请输入中文昵称"); 6 E* z9 N a9 a% j0 h: H4 r
document.sform1.chineseid.focus(); 3 q1 A0 q8 s, H% h! R0 V3 `1 A
return false;
# q) _' v0 l% C4 X }
5 N" a, d% v% G! Q! Z1 B' j password = document.sform1.password.value; 9 U1 i( u+ R; ]
if (password == "") " G* p& j0 @8 y, Q9 o/ q2 D
{ , O+ D; @ ~3 E
alert("请输入登陆密码"); 4 H8 X2 d% g7 w- P: A5 b
document.sform1.password.focus();
- |# t, H: s4 p% ?, f3 [ return false; 2 Z1 ]# |/ I6 q* c" \/ q! C7 P" W
}
7 R2 u4 F/ n2 L( z password1 = document.sform1.password1.value;
8 b. G2 I' q1 Y# f: d2 r if (password>password1)
1 i+ }, h5 y3 D8 q4 z {
1 K' b6 V1 J! y7 j; f4 k alert("重复密码与登陆密码不相同"); 7 A5 _" L$ B1 F4 A! p
document.sform1.password.focus(); ( d, l, B5 f3 ]) ~; A
document.sform1.password1.focus();
- ?' E' o% L/ \( a return false;
0 n. B% |8 V4 e } 9 B3 m ?# k) d
if (password<password1)
8 }0 n5 f% ~- ` {
- W8 z4 v& O7 T6 i alert("重复密码与登陆密码不相同"); " V" d2 X" k; f' v; q" G; t
document.sform1.password.focus();
! X& o- I- L4 j' U# ?6 m/ T document.sform1.password1.focus(); * d; N% F: p8 I5 P+ B) `
return false;
6 ^0 m3 I. @2 l1 n- @5 n } # Y2 ?4 p5 E$ @
if (document.sform1.email.value == "")
8 g% Y y( Z) \( ? {
8 G/ d( L( e" t& N" @5 p alert("请输入您的E-MAIL地址"); : E6 m: d3 \- J& d" ^9 m6 H
document.sform1.email.focus(); 7 a. g- h" f; ~+ x) U$ K L2 U
return false; u6 a1 O! f- m$ u
} ) Y1 I* e- {' P3 c6 ^+ n* d
2 f# N5 b3 P# U' Y7 f0 s2 R email=document.sform1.email.value; , a- u% w# l3 x" a7 P# J* l
emailerr=0
" ]( R- \, p0 z5 \+ `7 D, P, [ for (i=0; i<email.length; i++)
, j/ O5 E6 \3 A7 b, c3 ~ { : M/ W) I6 ^6 e+ u+ o+ P
if ((email.charAt(i) == "@") & (email.length > 5))
8 L. C; e+ H$ r2 f8 w1 [& P- T* N7 n { 2 R; P. f! j1 k' X" ?. m
emailerr=emailerr+1 " C& D8 z* j- V5 h3 y& Q& b" d5 j d0 r
} 3 J; E) o( A% u
} ) {7 g5 e ]. J, W5 P% U6 k' {
if (emailerr != 1) 8 G" o" _" U0 Z8 E% M5 g# \ R
{
2 {$ X$ v5 a" d# f5 u. e4 Z alert("请输入正确的E-MAIL地址");
) z# G7 J0 K6 S, F# K- K document.sform1.email.focus(); " W+ ?, r5 V" m& P# ^; y
return false; : W5 t8 ~0 q7 z. u) b
}
E% k/ C5 C' T; Y 1 U8 Y- l0 A2 {# P- G
if (document.sform1.checkask.value=="")
) ?7 l2 E, B: U$ c% W { 4 ~/ D9 H3 h! k
alert("密码提示问题不能为空");
1 `$ n1 S! Q; h g7 E2 U/ @1 k document.sform1.checkask.focus();
) ]- N/ S/ l% l/ e4 s7 T return false;
0 I- J S. r3 S1 L& K+ ] }
- \9 j; B: m6 r% n if (document.sform1.checkans.value=="")
- q' @0 @; S. e$ K4 u/ j; P, N { $ u5 L$ N$ A# b* d8 Q. r( }/ A
alert("您的密码提示问题答案不能为空");
. o, V* h; Q* Q* W document.sform1.checkans.focus();
& t, J- V1 j: W0 C1 V return false;
" d3 i7 P2 I. n0 u3 Q }
5 i+ ~/ x+ A% s8 | T1 I return true; 3 J5 h0 j2 _/ H1 d
# e6 }) J$ j/ P: v
}
+ z5 {! p9 ~5 x3 B Q: Q. l. P- _</script> |
|