  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14257
- 金币
- 2419
- 威望
- 1647
- 贡献
- 1367
|
这个脚本对你可能有帮助:3 v3 C/ n5 ^+ E' o7 P4 N5 q- j2 @# k0 U% H
<script language="javascript">
( y9 z' r2 w L/ Ofunction IsDigit(cCheck) ' s8 s1 m% E* |- x, J$ K3 R
{ 0 w8 {2 {9 |- ~2 R. v
return (('0'<=cCheck) && (cCheck<='9')); 0 C# I# o6 z7 U* w1 h, L
}
! P0 U) \! I+ \0 k5 r6 ^ 9 J1 _- z' k/ I. t" _
function IsAlpha(cCheck)
' O2 I5 i. B y% N { ; W4 k8 G4 @$ |- y
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
( x6 K( u# r$ H8 G9 s } ; a* ~6 L) {8 A0 ^$ {& M! m
7 F2 _: F$ p, K
function IsaNull(cCheck)
3 r0 Q0 M5 M. _4 K. P$ Z% R3 ^ {
& k( {. D# L. {0 l) ~$ _ return(cCheck != " ")
( d* |9 Y. d$ h+ w- V1 q% G0 X7 z } ! i6 Q5 i4 I/ B6 M+ {' {1 h; G
8 s, X5 w" p# L
function checkform() 7 Z$ y: O& S: A% q. }; d6 l5 N
{ 0 [, u, U# W0 I( i7 [+ q' s5 K
id = document.sform1.id.value; # ]# V2 y& P" W. w- j
if (id == "") * \9 i$ S7 C, x; v, g1 F$ ?
{ 4 T+ [1 ]+ a# S- b) J# Y b& E
alert("请输入注册名"); ' m1 V, b# E7 L* j
document.sform1.id.focus(); 0 i# N7 p; ], B: g/ p9 \$ A8 y
return false;
' }, ]: }, |. ?: t, \, G: N; z7 ? } * T- @ r0 L7 ?7 o2 M
% c) X" `9 f/ q4 Y. M& D8 k for (nIndex=0; nIndex<id.length; nIndex++) e u" I- h* K+ u
{
, p7 ?, T# \2 m! S8 \5 E) f: U cCheck = id.charAt(nIndex);
5 R$ k3 B8 x* G# o# k if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) $ m4 N! l, N; Z. c, c- S; P
{
+ T: Z! f! ?* ~ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * q( F/ G. o \4 o
document.sform1.id.focus();
O+ O) }% Q- P& x+ q9 R2 A$ ]& G return false;
* R/ O7 F- p( W! ?' R3 h5 ~ } 7 _1 W6 Q4 }1 n% z8 {
}
: m& U: {! H- E# v% D4 Q4 K$ S* C" W chineseid = document.sform1.chineseid.value; 9 B- U1 F8 j) M- c
if (chineseid == "")
: _5 P2 O7 ^( p/ D) x" A& b { ! i* [: s; a6 D. O
alert("请输入中文昵称"); 5 K6 \) @ K; l
document.sform1.chineseid.focus();
9 R3 G( |8 Q1 l9 V5 S: ^* f return false;
! J/ |( c/ ?" ^& h& A4 @ } 3 ?7 g4 L, B1 [- R/ F% J& I8 M1 `
password = document.sform1.password.value;
7 B+ y0 D" X8 x6 F, D if (password == "")
8 ?+ W) ?" T. b( P1 C4 D: o8 w1 }+ [ { - y7 h9 \$ D! a1 I2 U9 t
alert("请输入登陆密码"); 5 F+ g. _& `, K: v7 t
document.sform1.password.focus(); + k. C/ [+ c! S# V P3 p0 L+ _
return false;
2 Q4 O3 \" m& A" Y) a. D$ t& v0 h } 1 s2 F; p: F% a6 T5 M' V9 r
password1 = document.sform1.password1.value;
1 U F% g/ t2 {1 R( Z if (password>password1)
- u, {8 B. P" _# F, R {3 W! h* N8 D" P( w" |8 h
alert("重复密码与登陆密码不相同"); ' M% ?* v% X+ h
document.sform1.password.focus(); ; {5 T" h z; n$ g' w$ ~! k2 E8 g
document.sform1.password1.focus(); 9 \) y& c* z9 V2 F* B3 _1 d J
return false;4 N. k, I3 p; w' H P
}
A8 E7 |+ f) X* ^: Lif (password<password1) " X0 n/ z$ V: K, Y4 e# R
{4 d5 c& e5 K& z% y1 \
alert("重复密码与登陆密码不相同");
; a i( W! \# r) W, A, w+ k ^ document.sform1.password.focus();
7 j; C4 O9 x. H$ X! N, Y document.sform1.password1.focus();
, ?( U4 R2 _9 x6 E0 l' n M return false;' i. f+ e, C2 Y6 G9 e4 F8 D: [2 I4 o) H6 R
}
1 L7 V" r, o7 k& x5 }4 `) B/ { if (document.sform1.email.value == "")
1 C: b( f6 e, M: V) i- ?8 Z: C { 3 O7 L. h4 ~/ m/ r k6 I
alert("请输入您的E-MAIL地址"); * e- Q; n; d8 u
document.sform1.email.focus();
. J @+ W) ] R6 S return false;
+ ?0 Y; Z3 E, v* @' ^ }
$ N; e) J9 y8 {% m" p0 e5 w
}; \: k/ s, Q; t' J9 y1 U6 N email=document.sform1.email.value; + o) u6 L4 C' d1 i( d) f
emailerr=0
% r; h) c0 d& y* Z for (i=0; i<email.length; i++) 3 K1 u, L+ z4 G* Z4 k6 I" W' C
{ - L( h+ C2 Y( M. e" d0 f
if ((email.charAt(i) == "@") & (email.length > 5))
9 h j( D* n3 ~- [+ c0 k( W { 4 ^1 W! {' q% Q8 T5 l) l8 D a
emailerr=emailerr+1 " d' a0 w2 S. B4 V; u7 u
}
: ~" i2 K6 D7 m k } @3 f$ m: \$ l
if (emailerr != 1)
' p' ]) d" G- s5 q { ' F( o3 ` r h; W b: f6 [, y; \% i
alert("请输入正确的E-MAIL地址");
L. ^% T1 |! ~7 c9 c- S document.sform1.email.focus();
- q! g" N, y( _/ p' O+ ? return false;
: z* }9 C) M# u+ H1 T } & a% m5 J9 G' m+ e. c* t; B# v- |
( l4 w' ?) D5 h. ^/ j
if (document.sform1.checkask.value=="") , S" _/ K3 ]8 N
{
% v4 o4 F' d$ g' n6 _# U- [. v/ }3 _% J alert("密码提示问题不能为空");
( A0 X* ?1 W7 ~, `: R0 W) W document.sform1.checkask.focus();
2 O! V/ }- t6 U* t return false; 0 @3 O; o: R; e# }4 M
}
" l! _& I% n/ {9 K if (document.sform1.checkans.value=="")
1 k! b' n0 [5 x' R { * R9 q f" t0 U# e; Q1 g
alert("您的密码提示问题答案不能为空"); & t* y9 J, [5 x' O: j7 ], [
document.sform1.checkans.focus();
- |6 L4 z1 k3 _, m return false; N% F- y( K/ i' ]+ N
}
9 ~; |" c8 m' h& A$ P3 l return true;
8 W# P- }1 p1 k, d4 K
( f7 d$ y4 p) U# k% R& y6 ^7 I} 8 O8 F/ \5 v+ P, W9 {
</script> |
|