|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
这个脚本对你可能有帮助:
, z3 W" v K1 H a( ?1 r<script language="javascript"> * _. f" X; f; c: u9 }) U# R! ?
function IsDigit(cCheck) * d' H; _, m X/ [3 E
{ , T a# d5 ^! S- l: w' ^
return (('0'<=cCheck) && (cCheck<='9')); , G( `- h' d' n% O: n, T
} ) M& t& m; l0 e t$ y& F. S
) l& x$ H- D- C( R
function IsAlpha(cCheck) 0 v$ s% C ^* {0 z7 R! o0 N
{
8 z9 D- i0 A% x8 L return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 6 }3 X3 Q' }. q% z* b# F$ s7 n& E
}
' u5 D6 y0 B; f, O: v% x 5 Y1 C0 r$ h k/ H" J
function IsaNull(cCheck)
6 P! J0 b: w3 ?6 E0 a* [5 x {
' v# `9 I0 M* ?$ F+ D' E/ i% X return(cCheck != " ") ! D0 H, o4 Y! n' s1 y2 Y; z, K! ~
}
. D4 D _% t1 n& d+ ]! T 8 P" V$ @5 W2 `* R8 p+ ~& |) V* ^
function checkform() 1 f2 i3 e! f- @
{
! u1 p" }0 `; k* c& u! E id = document.sform1.id.value; ( g/ V. s- Z( x
if (id == "") 3 w$ V/ ~' Q) p) S
{
I: f+ e- x. A1 k M; p& t alert("请输入注册名");
/ ]+ h2 A h. y; l document.sform1.id.focus();
9 h; ]$ f% w* d1 U' d p return false; 4 ~4 i3 t: Z! m- r" K
} 7 v/ j( W) U3 `/ o( q
# Z! m" l+ j, A; w for (nIndex=0; nIndex<id.length; nIndex++)
) v9 M0 ^# P& j$ I {
2 z) P$ E. M) s/ b+ n5 ~ cCheck = id.charAt(nIndex); $ k7 [" q' `# F, c
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) - c! d! G* O0 o/ f8 |9 R* ~. y
{
9 r- Q/ M: B" N alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 3 o7 ~" I5 \6 K( \
document.sform1.id.focus();
' @) h% A& G9 ?5 t' z9 m return false;
# a8 Y2 }# f- x0 w }
2 h9 p) Q/ |, q }
/ J/ c: N/ [) } chineseid = document.sform1.chineseid.value; 6 Q7 p& i+ E* B+ w) [* b
if (chineseid == "") * [& b1 N" l1 c% ]: f
{ 0 W" \! Y+ p2 I- T2 J( k, o
alert("请输入中文昵称");
+ L6 ?/ |' N* X5 N F* m document.sform1.chineseid.focus(); 5 Q; u, E9 U7 i8 v( J/ X
return false; $ f; r. g4 S* d4 C
} 6 C/ m3 C+ M+ m$ p, h
password = document.sform1.password.value; . f+ d; k) o* D( {
if (password == "")
3 T$ D# [6 D8 B+ e! \ {
9 i o' H' u( H3 P alert("请输入登陆密码");
4 T8 s8 a8 y8 C( D9 Z) v. [* C document.sform1.password.focus();
. q# w. q1 r: ^- c return false; 1 W x7 G3 G8 ]5 O o: B/ {( N( x
} 6 p# x# o4 m0 q* h% y7 ^% L: A5 f
password1 = document.sform1.password1.value; ) O! `3 d3 q9 p" q5 Q( a* L! J
if (password>password1) 5 T) I9 t# ], u0 z6 L
{8 z) s5 a' Q- t- [6 @8 h
alert("重复密码与登陆密码不相同");
1 \ s5 z: q, y2 D& e9 M, E) s document.sform1.password.focus(); * ? P& ^% M$ J# \5 U
document.sform1.password1.focus();
2 k8 B/ @$ i' }' i# q. { return false;
- c, k( F9 l1 K3 _ } . w, `" B+ i8 `( }
if (password<password1) ; g! ^2 |; n1 k* p
{
% ~4 I! d8 G1 G. o/ p8 G: Z alert("重复密码与登陆密码不相同"); 7 z: S% F3 S8 y! g) h( z
document.sform1.password.focus();
2 ]1 T( V+ j5 Y document.sform1.password1.focus();
/ F$ v4 R7 G* h- c+ [) B! ^ return false;
9 Q9 C# n! H3 b) n8 | r } 5 j4 ~: d9 }6 ], g3 S- H
if (document.sform1.email.value == "")
; P, Q# W1 W, d) J { 5 J! m! `- V: o' Z6 f( j
alert("请输入您的E-MAIL地址"); + [* @9 K! h6 E8 u
document.sform1.email.focus(); , }, ~9 V2 J* e7 ` n; F
return false;
! v4 X% V3 N0 T/ \ }
7 e3 z, g F2 j ~7 H + c: i' ]- t) v3 L$ p; ?3 ^
email=document.sform1.email.value;
' c/ s+ j% I+ l& f6 Y emailerr=0 : P, G& d4 |% A0 E
for (i=0; i<email.length; i++) & m# ]9 H* C: _! k& [* `
{ $ u8 x# [, d. e7 P$ f% y6 o; p
if ((email.charAt(i) == "@") & (email.length > 5))
3 e/ g) ^3 Q! T4 S( N- I1 B. s { % a- g9 |4 m3 c4 ]( C' `) S% |
emailerr=emailerr+1 2 C( }+ u4 e( W5 {; r
}
. X; V' k) Q- A+ h# @3 b$ P& t- Q }
. c2 m V" c% H if (emailerr != 1)
; R, Y# m" c5 y0 [ { & I' X; ^0 ^( ^: C! _5 `
alert("请输入正确的E-MAIL地址");
, a2 V+ d. i3 S. b+ G, c document.sform1.email.focus();
; I( ~: W( J3 p6 b& t& l return false;
" [. ^( K9 S, ] } 6 P+ [6 j- L3 e# |: t
8 }2 q! @; c- J* [ if (document.sform1.checkask.value=="") ( ^1 s. n) A- z: _ w
{
% c- n: B# W8 J1 U$ M alert("密码提示问题不能为空");
" V/ Q ?' W) K% _ document.sform1.checkask.focus();
& T8 i# V5 e7 P return false;
1 Y! s6 | C. ^. u1 y* z5 v3 \ } 0 E) W5 e4 B/ {% d! x% E" `4 n
if (document.sform1.checkans.value=="") 4 @' p" M/ J& I) E- G2 d) b
{ / i, y1 ~+ E9 _ |- R
alert("您的密码提示问题答案不能为空");
2 r! }$ a2 q$ K" z# S1 L- V+ o document.sform1.checkans.focus();
% {0 x1 {) S$ z: f9 [3 b return false; 5 v! _& `* K7 j8 E8 c9 `
}, s$ {. _, o8 O! P! p' h0 J
return true; 3 \) u2 z: g* Z6 t7 Z
( t9 @" \( T1 l% ?* s}
2 p: t8 E& a ^7 z7 @3 [</script> |
|