|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
这个脚本对你可能有帮助:
2 S G2 j2 z' q1 i& {' d<script language="javascript"> 3 H% ?; w8 C; p$ s
function IsDigit(cCheck)
" a Q+ o' O( @/ Y, y$ k { 6 l0 o ~' d5 K9 D& P
return (('0'<=cCheck) && (cCheck<='9'));
- _" h! z' V* k1 g8 \) M }
4 h6 z1 P0 m1 t; k8 j5 C ) e& o2 ~3 W( B* ]( ^
function IsAlpha(cCheck)
( J* p' y& G' P. |1 c7 C {
: @ U* C# L& p5 T5 D* _$ D9 C return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
" ]) m1 n& Y, N' ^7 J }
; Y6 B, p x* @# l . d; X, G5 c. u3 Z. e4 V
function IsaNull(cCheck) 8 I. f5 g( Q! T/ l/ q
{
) T R, D$ E% }1 m* |8 ~" q1 V return(cCheck != " ")
+ n6 ^ r3 w0 p, s5 k& A! B, p } 0 k3 w3 `5 q$ f' m( L! {
. k- Y" R k% K) qfunction checkform() 7 [ q) M! f P7 h
{
' l& b; I5 T# j) ` id = document.sform1.id.value;
/ h0 |9 ~7 L$ z: s if (id == "")
g. {2 p. d+ \ { # Z0 Q* u" @% p; P8 G, i" j
alert("请输入注册名");
1 w+ n4 J, c1 m+ s, W- m/ R document.sform1.id.focus();
7 U# g4 q1 l- n* t" y% [ return false;
5 w5 C4 D5 O3 _) Q3 P } 5 \$ P( S5 g, f1 E5 j/ R
7 R- Q" n; N9 x7 g. v7 ~6 ^: r for (nIndex=0; nIndex<id.length; nIndex++)
: d5 v; O% _5 V0 J+ S* c. Z% e* X& e { 7 f, J6 \* f+ T' Z4 E) l
cCheck = id.charAt(nIndex);
# e" }& t; u/ W) E: j: a+ Z if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 1 } F$ m6 }5 R$ P8 o
{ 3 d K; S/ B5 w/ ]* I
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); : O+ t% d! v3 U' Y# V* E9 @ x
document.sform1.id.focus();
T7 x6 q* y; M/ r4 F: ?( y return false; T; H% K- P7 t4 y4 ]2 g% s
}
6 T- D; A* { \" J! q( D } ( S$ A+ I/ b3 ~3 \- R
chineseid = document.sform1.chineseid.value; 6 v. [1 U% N3 }+ P
if (chineseid == "")
9 {, H4 B6 E8 |: }% \- w2 W { 0 G% d& Y/ q; L6 a
alert("请输入中文昵称"); 3 H/ C2 R' _4 P# N0 m. M7 u: V
document.sform1.chineseid.focus(); }7 S( E G( s: e, n4 [4 S6 k
return false; - D) \5 E6 q% x1 k1 F
}
, t7 N. z/ e2 C password = document.sform1.password.value; 5 ^9 k2 T' U! T2 ?/ i
if (password == "")
5 @ m3 T1 g; B" [0 G { ( @) \! v% ?- h$ c
alert("请输入登陆密码"); 2 A; H1 B: w3 n, V" b, i! `5 W
document.sform1.password.focus();
: Q8 ~- b/ c, x+ W( C" A0 f return false;
4 D' O1 Y7 l/ t( N9 l) X } 0 s0 M0 W; W5 c5 Z* B
password1 = document.sform1.password1.value;
8 I6 O" j, d- @9 c' e) _/ ? if (password>password1) ' c0 r! t, ~, h
{
# j: ^ ~3 E$ i( g6 u& @" H) S- V alert("重复密码与登陆密码不相同");
- \: j$ m8 q3 \5 `& M document.sform1.password.focus(); . L; e" E8 ^# N# o7 Q0 `0 _
document.sform1.password1.focus();
: M* n: f9 Y5 e$ s/ \' V$ V" m return false;
) c' o- b5 \2 h) R% U0 ~, g }
4 L& R" o* P) l# r3 mif (password<password1)
2 j9 _% K! I2 U6 Y0 W5 X$ b0 Y K0 F2 U y {. W. B) U, c8 E; s$ D( c5 }. i3 Y
alert("重复密码与登陆密码不相同"); ' h& {# c' b) g2 _4 ]' Q, L
document.sform1.password.focus();
2 x2 v, ]% s( w7 ~ document.sform1.password1.focus(); 6 f5 W$ D% t; W2 u. ]
return false;, P+ ]' j* B2 _# E( D2 R
}
, N. D& M p( Z6 b1 R if (document.sform1.email.value == "") 1 h$ \* ^% @0 K6 V1 T9 S
{ 5 [6 n9 Z! x3 S8 e; F
alert("请输入您的E-MAIL地址"); 3 N( ~% V6 l u9 g7 e! ?3 ~ x
document.sform1.email.focus();
. H. Y. c+ F4 `) b) w return false; % V2 u- B: A, t$ M9 b8 k) Z; t
}
& H/ Z' {1 p- X- R
! Y2 F& K, s4 l) W1 ~% W* P email=document.sform1.email.value; , S1 T6 ]! D; T9 M, c! o9 L
emailerr=0 3 Q0 A8 O G% _, }
for (i=0; i<email.length; i++) ' P4 \4 x7 f* y
{
2 c8 ]1 E( f8 Q! I if ((email.charAt(i) == "@") & (email.length > 5)) 8 I& e1 N6 Y) t! C/ i, d4 W! i
{ 3 x' v; m- c c b% [7 K( E
emailerr=emailerr+1
0 X$ }0 o8 v, }* J1 Z7 v } 5 n! n7 P1 f4 T! k
}
6 I0 c. Z+ u3 C D if (emailerr != 1)
* `9 V7 Y# U8 ~$ I { : y: R5 e% x. q6 E$ [
alert("请输入正确的E-MAIL地址");
' [. z$ m( j! ~* e; p8 Z2 k document.sform1.email.focus(); ; N# ]8 n- I2 B% l# R. g& [
return false;
" g* ^2 N6 }) z u }
' N: @7 H% {/ k' n8 s 4 P1 Z5 b* u6 L7 ^# P. v$ d
if (document.sform1.checkask.value=="")
8 A$ f' a, E. y) i! ~. } {
. u3 k0 M1 n' _6 j4 d alert("密码提示问题不能为空");
1 V( S, \5 i5 e" | document.sform1.checkask.focus();
1 E( U- \; m' Y return false; & ~" Y8 C/ u0 {. o3 e" c! u
}
: R9 A2 K( ^& s1 R6 C2 s if (document.sform1.checkans.value=="") ( r7 g. C0 s0 ~( n/ Z/ H
{
: a* Y1 F5 G0 Z0 h/ y alert("您的密码提示问题答案不能为空"); , V+ i% |3 n2 B' a: i" j. g
document.sform1.checkans.focus();
" Z) K ]# M8 N6 e q0 ^, L M return false;
! B6 R- n$ I `. I3 r' ^ }6 i2 m4 Q5 h: }' w
return true; % v/ n+ q5 L* c6 \
7 d3 ~0 q/ E% u$ N} 0 R/ M) I4 P4 z" e7 a
</script> |
|