|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14279
- 金币
- 2430
- 威望
- 1647
- 贡献
- 1378
|
这个脚本对你可能有帮助:- k$ B# F: @1 C4 O
<script language="javascript"> 3 O, ^1 I$ q: ]9 J! v' V. A$ Z6 S
function IsDigit(cCheck)
1 L4 B9 s. T7 N$ C8 J7 Z { ) }1 l3 ]+ l: x. P* s" ~3 w6 ~0 O
return (('0'<=cCheck) && (cCheck<='9')); ; Y$ q) o" X$ {5 T3 O3 _+ C/ o/ T
} / ^4 o, }5 Y: w/ A$ n
: z) a# P, _% ~/ O5 Q* j
function IsAlpha(cCheck)
& r: k0 V) j) m6 A3 L+ M {
8 h5 ?7 Q, |; u6 n3 B# Y% H$ O return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
% A0 n/ O% S6 H6 S. c4 K2 M }
& a* H' i% r! z B+ H a& j% H $ r+ |, m; l N: q, H
function IsaNull(cCheck)
% K: }' C& ?& o4 B" n- u+ Q {
6 k5 B* o* k4 C2 G return(cCheck != " ") . S& ~* r6 _2 X% |! k3 o
} + n. D2 N9 T4 g! x) {$ c
H* v1 q3 h3 g: \& W& K4 R. E% m
function checkform() 4 ~% H7 w+ h/ n
{ + y" m7 d. F# f" H( i; Q+ {# x
id = document.sform1.id.value; 0 i2 b2 j" T/ ~; s% P
if (id == "") ' J! b3 z( w( P. |7 ]
{
4 M7 a4 P6 s3 n7 G alert("请输入注册名"); : n/ ^. ~ D, i/ {6 N
document.sform1.id.focus(); , e7 K2 K% u; E8 F( ~
return false; / A- u q; Y5 A& n5 ^3 _* F
} ) }' Z4 |, B' f6 R6 _- u6 n
! h; s9 y, `" I: P for (nIndex=0; nIndex<id.length; nIndex++)
0 }, N3 C; H1 \9 n8 \% D { 8 x* a( F4 m& F6 r8 Y
cCheck = id.charAt(nIndex); " ^+ F/ U7 z/ c i4 C
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
3 Y- X: X' C) V1 O {
( ]) C; }% d+ O9 H alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , F- d N, U6 D3 q! I s( p
document.sform1.id.focus();
5 Q% ~% _+ [5 P# N* ?. c& Z return false;
( O! q4 [! k/ o3 W. ` } : E' U; R8 U" u7 F% O4 j) z& g
} # U7 p9 s$ ~1 J) v- q% M+ e. C3 H
chineseid = document.sform1.chineseid.value;
3 ` v8 e1 p8 n1 Y* k$ Z) Q if (chineseid == "")
( m; e, y& [% z, O9 K% w% Q) q0 d {
7 ~" `: o/ ]! R5 l$ M/ v alert("请输入中文昵称"); - [4 _& i, `4 u" `7 R
document.sform1.chineseid.focus();
/ b1 ?- b8 b3 c4 ?( X return false; U, u$ ? h% R+ e/ k+ ?& T, \, z
}
) @' x D0 x9 A1 l3 G" f password = document.sform1.password.value;
- _: [4 D+ E: N' i$ Y6 y if (password == "") 5 f) ~# Y c n- R7 t* y6 G3 z/ Q
{ - U# I- K& c& O2 r+ ?
alert("请输入登陆密码"); 3 _, y% G% \. _$ A7 M/ {" B1 t/ Z
document.sform1.password.focus(); / L4 s8 w8 h6 z
return false; # }* S5 S7 [) \8 y6 w
}
a( N" G/ @7 ` password1 = document.sform1.password1.value; 8 b$ D; b+ c/ ~$ t0 u- w+ |
if (password>password1)
2 g8 f/ _7 I) [9 l) J8 A {
: }3 x- t# G7 v& w; U alert("重复密码与登陆密码不相同");
& e( Y+ g& P0 m- [ document.sform1.password.focus(); & `8 R5 F+ a- m7 H
document.sform1.password1.focus();
5 [. t% `, x2 b! f/ j+ ? return false;) v. d, X) c$ |
}
# M' R" H" W& p& P& Xif (password<password1)
! _: G( u/ z5 {: {2 v# Y {
. S$ d* P! f/ k o- [$ J alert("重复密码与登陆密码不相同");
$ r& u+ C& Z; ^' K' F, ^ document.sform1.password.focus(); # N/ n; _0 y4 C+ F; d' z) [
document.sform1.password1.focus(); 0 f( {0 u- d8 P6 H- u
return false;5 V% r# U( i9 K& f( H
} $ |3 ]* Z8 Z; p/ h
if (document.sform1.email.value == "") ) B }7 u& h% u, `( l: `
{ 4 e) s: Q8 @6 U# S4 b u' n
alert("请输入您的E-MAIL地址"); 8 s; ]) Y$ ]9 f: I& B
document.sform1.email.focus(); , C0 C6 x1 y' ^% F' z
return false; ( W2 M8 O) M# R8 j( W4 k5 t% `0 [
}
s5 b# K8 w+ @2 u5 z 7 n# L+ ]* O* R3 D
email=document.sform1.email.value; / ~. {4 W0 U* m
emailerr=0
. W, n: x3 T' [5 P3 j/ Y" w for (i=0; i<email.length; i++)
6 S' r5 c0 F+ E& B8 i/ V7 [ {
^. t2 r6 U9 R5 s( X( ^6 r; Z1 m if ((email.charAt(i) == "@") & (email.length > 5))
" V4 t# c0 z& M4 d {
/ `" c* n+ f3 I/ H- ~( l$ e/ \ emailerr=emailerr+1 + S9 Q, p% D1 |2 V q6 J7 r
}
# h i! q; I8 Q7 ?: f! | } ; r" T* g3 ? X1 W
if (emailerr != 1) 4 z. J& s z6 N: w$ Z
{
0 {" e( |4 Q! P E0 z6 ]5 E$ J4 z alert("请输入正确的E-MAIL地址");
7 @( h: [) \; E, h9 ?. D document.sform1.email.focus();
& k8 K% A* o& p! K return false; , I3 g3 V# c, _
}
3 x8 R" r8 {# B7 M0 y5 l
& m3 w4 C# s% N4 c9 e, w4 z if (document.sform1.checkask.value=="") $ s% T s# t+ n% F" n2 J
{ : Y q' c+ B( g, c
alert("密码提示问题不能为空");
0 A- y: R1 B: I0 A/ T7 n8 x' f document.sform1.checkask.focus();
" y! q" f1 a; f7 y1 L [2 t return false; + ~5 O8 w& v, Z( m
}
: X" A( M- n' O if (document.sform1.checkans.value=="") $ @$ r, D- W3 q0 j, `1 J( M: p
{
) c$ p- e9 h, k% A' l2 M alert("您的密码提示问题答案不能为空");
0 K- c( t# H; R7 n document.sform1.checkans.focus();
. @ S- D/ J! T4 @ return false; ' I M6 h, m. V4 V
}' w& g* m7 `5 R" H. K8 W. e
return true;
- e, s4 U' _! h5 t$ s) n
7 \5 u" u5 X7 I6 W4 v- D}
. b$ u4 N8 o R</script> |
|