|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:* E! i1 J# [/ Z, D
<script language="javascript">
' t3 U7 z; l; [+ B" W5 N6 A% G' Nfunction IsDigit(cCheck)
, U4 m$ t' o0 e# D0 k( n { ( J% p8 Z4 ^5 @0 B4 F
return (('0'<=cCheck) && (cCheck<='9')); " y' X5 Z+ D$ W% k9 J5 h' F4 f
} $ h0 b6 P& U. W3 Z( Y) S( K
" V, b) N4 V# w
function IsAlpha(cCheck)
% @) X: \( E0 u6 W1 v6 ~2 L { + P P: A& r' U" F' R4 m* Z4 o; j: b
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 1 O3 x% \ X1 }. [; A. \) f
}
& @) }) x# b& C5 s+ y! w: L* A ) D, C6 r* Y: ?1 i) P. l# y
function IsaNull(cCheck)
: [. l- X( l2 F { 5 r, v9 n7 Q" c* G5 _
return(cCheck != " ")
+ N4 Z+ ?2 z+ I } 7 c+ P' c. c: ~1 O) G5 j; A$ P
; K' B4 \; j) t+ c' Afunction checkform()
B7 V- p' i7 ?3 m{
4 r/ V+ o0 p# m. G2 W* i id = document.sform1.id.value; Q* f$ D7 X% C& B2 W( c
if (id == "") & e: F2 o3 v* e1 V+ a, p" J
{
9 Z! h4 p0 O5 X, |9 x alert("请输入注册名"); - F) a# `/ m9 H! [1 O
document.sform1.id.focus();
6 a1 E. x' q4 M n6 g' F9 T9 N5 U return false;
; T2 i* h" S; D; e1 R; K }
3 g5 ~" d' z1 j% q 3 L- g( U$ {6 y! S; W. o
for (nIndex=0; nIndex<id.length; nIndex++) ! y( @& f9 B& J- ?' t3 K/ T
{
5 C; r! R$ P5 {- | cCheck = id.charAt(nIndex); : q9 M }) u s1 C1 p/ t" N+ e- P, Y
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 6 t) q9 U+ l1 J% b5 p
{
% l9 t; U9 i" X0 U9 y& l6 D3 o! p alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
3 i3 J/ k$ s6 x document.sform1.id.focus(); + \" d. t3 I; J3 m( g# O
return false;
& m( \) m/ H5 c+ z) ~ } + Y+ `) X( o% o' c7 S" c) n
}
! c6 x) ^# k- \& ^! z3 ?8 M chineseid = document.sform1.chineseid.value;
$ I8 p0 R/ W& x+ M0 z4 p if (chineseid == "")
. a( c: F9 z1 ^9 u( Q: Z, \' Q {
- c4 F$ \) G8 g2 ?4 T( f* y alert("请输入中文昵称"); 9 G. i1 {# d% j
document.sform1.chineseid.focus(); & a3 f4 d/ t2 w- }6 |
return false; N1 s& W1 \% b- e6 Y# R' d5 u
} & k/ e$ N' i: i9 |. q* k( x
password = document.sform1.password.value;
0 i( P/ A5 i0 V3 T6 B; X if (password == "")
& Q8 c3 J6 R1 _/ V: D {
, {! c5 U t+ r. B) k alert("请输入登陆密码");
5 P$ W8 }& c9 p2 P; | document.sform1.password.focus();
. f7 T( D6 Z: {4 x- R5 u! D return false;
' ]0 s9 ?0 c5 f0 f" ] } 0 a- h1 k/ @" k1 U/ r4 m
password1 = document.sform1.password1.value;
$ h* A2 x) W9 E/ f2 m! ], t if (password>password1) ! X) }- n8 A: {$ e0 E1 X, C
{; _5 i) M1 I8 K; K- t Q. W
alert("重复密码与登陆密码不相同"); 2 C. i0 L" G3 }& M2 m. F
document.sform1.password.focus();
0 _. N: E7 ^6 m5 X* _# O0 \ document.sform1.password1.focus(); : C2 R# u: P6 _- ^! y" R3 K
return false;
# ^3 R) }! D4 `0 z9 i6 m }
+ e( \8 I, o0 sif (password<password1)
4 ~" d+ \7 ~% P. O- d& T( Y { y$ Y& M/ U* a2 a! e
alert("重复密码与登陆密码不相同"); ; \' Z6 E5 t8 U
document.sform1.password.focus(); 5 m; Z4 ?$ `' p& z; F y w0 n
document.sform1.password1.focus(); ( |; e/ k* L8 E( I: j
return false;
" A8 h& W. k2 d( F7 a% `' J: ] } , G, R" ^3 c8 O" i W1 E+ \
if (document.sform1.email.value == "")
" i9 p# w8 B2 ~* c ~ v { 9 p* a2 K6 b: U
alert("请输入您的E-MAIL地址"); 4 V! V8 d Z! X# v$ _
document.sform1.email.focus(); ; \0 j+ o' u c
return false; 2 F6 J( x, L: G1 V# p
}
, r6 x A8 a" b 8 R0 X6 A W9 k* V' X7 v( Z
email=document.sform1.email.value;
S& s( V6 b x/ {! a( o emailerr=0 . l3 k9 ~' c( e; P% x! u9 @
for (i=0; i<email.length; i++)
" g5 j x+ ?* h; F' H5 x { 3 d$ y3 j8 ~5 H" {' C& I: M9 _- j
if ((email.charAt(i) == "@") & (email.length > 5)) 0 ?+ ]$ `1 z/ Y
{
4 N4 V( e1 t: [, C' [# Q9 @ emailerr=emailerr+1
a* f8 h( u/ q } $ @. U) H: {9 Q ]
}
" [7 b3 U; \. X6 G5 ^ if (emailerr != 1)
8 B3 B& @) T. J7 H" o# w3 R { , p' N5 }# r0 |- n
alert("请输入正确的E-MAIL地址"); , U; i$ \* h5 H% ~1 z
document.sform1.email.focus(); + p9 d7 ]1 y; t" E
return false; ; {+ T7 v* c- Z5 w9 ^5 W
} 8 ?9 R7 `1 F( j8 a
% l7 D# Z8 U* U: R; N$ r+ y" Y
if (document.sform1.checkask.value=="") 7 z8 ]$ m5 P+ \/ U; y# y) |
{ + O' G/ b, S/ l6 t$ s/ W
alert("密码提示问题不能为空"); - v" q( z- K4 y' k4 f
document.sform1.checkask.focus();
. |: x2 c) A' t8 X# A return false; # |7 f8 g) E) x+ \9 n
} : W+ I9 o# M6 R! R
if (document.sform1.checkans.value=="") 8 J) Z! ^5 g, D4 Y( g6 r
{ 2 k9 k: ~1 t @5 Y3 R
alert("您的密码提示问题答案不能为空");
. p N- |- a$ D, c6 X2 S document.sform1.checkans.focus(); * B( Z4 f: {5 V1 [7 R9 K) G; R
return false; 4 j$ |- n, E1 n0 O
}
4 j( i, _ j5 o& ~! ^" M return true; ! `2 m2 H8 y X' V" n b# M
- i. P2 v9 j. o5 n}
& V8 T2 G8 V+ O& n! Z- }+ J</script> |
|