  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
这个脚本对你可能有帮助:
; P% Y+ c' C( e' g. {<script language="javascript"> 2 v/ x8 o# Y$ g0 l3 g: d
function IsDigit(cCheck) $ l6 W; C# H4 j `5 k- ^
{ 5 r! c5 c) r; P. P
return (('0'<=cCheck) && (cCheck<='9')); 4 m( ~% @ D# `/ P) y( m
} ; a! D3 k I4 f5 V; [6 N# F" D
" u5 x4 [+ K$ N( \* m1 Jfunction IsAlpha(cCheck)
! X' G, e$ ?6 x: W2 H, e {
8 L/ A8 M7 e F# W7 {$ M return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
. `# G' {" y% U5 x- R }
* y' h" l) u# i7 H9 @
{8 G5 O7 S, Ifunction IsaNull(cCheck) 3 ~2 }9 d7 Z0 g/ W4 }% d& p
{ ; j2 W* _' P9 ^! b3 z6 V' h
return(cCheck != " ")
$ q- d# M% k5 y9 J% n- I$ I1 S }
" ?" D. f" _. R( K( J 2 w$ s/ u" v" |8 i3 A3 k
function checkform()
% X+ ?: ~/ L+ u5 v9 m{
2 K+ d% K# S X) ]9 h$ ? id = document.sform1.id.value;
3 o4 y4 n$ J. }8 B% Z3 z8 Y7 \ if (id == "") * [6 ^+ g# Y; \6 d
{
7 O- J( L6 K2 c# Z% N: |7 d7 v alert("请输入注册名"); $ H0 m# x, t8 l( Z! y& r9 r1 g* k) G4 ~
document.sform1.id.focus();
, r3 b" Q0 B, N y: A2 D return false; ! a$ W; u4 U1 w: h+ q! s: |
}
+ f7 P1 r3 I$ h d( | 0 @& k* L) w* Z# Y, `8 e
for (nIndex=0; nIndex<id.length; nIndex++) ( b: D( Q( L. |; w7 U2 g @9 n/ L
{
, _* @1 o% J3 u$ f cCheck = id.charAt(nIndex); + } [. V- e) ?: b. S2 \
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' k& s( K& Y" I' N5 q6 K; M {
* K6 K Z; ]4 g4 |; k6 l3 U alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ( Y; ?1 @" Q2 s! k* F
document.sform1.id.focus();
- x- [# K2 B1 g5 k$ o return false; 7 F+ }9 ?. N1 D& q# r
}
3 x' _9 O" M, h% h } ; T! _3 l0 q' l0 r+ z( u
chineseid = document.sform1.chineseid.value;
, d$ y& s" I' Q: r6 C6 [4 ^! v' B if (chineseid == "")
2 O% _; H4 o4 K3 z. V8 \% j: I4 ~ {
+ [: y" e8 ~" ~) e* X! q4 K4 ` alert("请输入中文昵称");
0 U8 r# v* j$ J+ \( { document.sform1.chineseid.focus(); " M+ y7 j1 {9 N: G. r% ~4 E# G8 C
return false;
3 `/ P# x) B @ } 5 I$ k q! b; T/ _
password = document.sform1.password.value; % Q! e( p; W+ @
if (password == "")
7 ^( f2 b( p' _ K {
2 g+ d2 }6 a" g8 o8 s/ d. a( u alert("请输入登陆密码");
8 Y0 }) ~& ?" L+ t4 ~; h% | document.sform1.password.focus(); & G- c/ v @& P( U0 @2 H8 s
return false;
% V `. }3 \% G+ f }
" F/ \6 [5 W0 k1 }+ h! ] password1 = document.sform1.password1.value;
5 f2 ?0 E7 W" u) k$ x m if (password>password1) $ c8 w7 A; {1 M5 I) \' d
{
3 [) E6 H, P+ r* r! I4 M: N% t alert("重复密码与登陆密码不相同");
* w8 K. G" ?% a* y& h) A! B document.sform1.password.focus();
* g' N9 i8 D7 I* m! V8 p) v! F document.sform1.password1.focus();
' r9 ]. D' C$ s0 a8 M( U return false;
' d1 B# l' J% H9 m } $ ?# O2 f& H, N1 N" V% z
if (password<password1)
" W( K1 O$ O+ T z0 v, q4 y) n {9 p* q2 G. K' X- c4 r2 `. T+ _2 ^
alert("重复密码与登陆密码不相同");
9 Z' e2 v4 }+ m0 z2 X document.sform1.password.focus(); ' h" z% A2 I9 X+ O
document.sform1.password1.focus();
: I4 B$ Z4 u1 `3 p return false;
$ {- P; L& x. a; o- ] }
; ^! P9 i7 f1 y, q if (document.sform1.email.value == "") 7 R% d. q' e/ z+ h' @6 W
{ 1 ^! i( S, o8 X4 k, g' s
alert("请输入您的E-MAIL地址"); ( i4 a/ \0 E, Y; W8 T
document.sform1.email.focus(); / U! S! l5 \8 l! X& W: V
return false; , C" C. ~7 @6 U, n, W& @
}
+ y4 Z; m% v9 b9 }+ g
# |5 p2 [- `& m* p+ [, O" @/ p8 `, P email=document.sform1.email.value;
' R: z$ B3 c$ L! L( Y emailerr=0 1 t: \4 P. t/ {- T {9 N N# n
for (i=0; i<email.length; i++)
2 W/ V! o) t6 F7 b x {
6 e) d- y$ S8 |* F$ t; r if ((email.charAt(i) == "@") & (email.length > 5))
0 e0 I! @3 |8 K9 T7 ]% D+ G1 S [ {
" m3 z8 N, b" \$ H$ ]# N emailerr=emailerr+1
5 a) e. K# V" t1 o" [ } 1 c. }. g. |: ~
}
) }/ \" D& n: F- b1 X+ F if (emailerr != 1) / l r* Z7 W$ m r, q5 i* F' C
{
$ s% K2 T+ }+ }* M: Z alert("请输入正确的E-MAIL地址");
+ m9 x% n t8 {# m# v1 e+ E document.sform1.email.focus();
1 u" G9 C. a8 |- B return false;
9 X4 _- Q& s+ D4 k, ^. S } * _% @7 s" ?4 m# w2 `
7 k3 ~9 }' p. i1 y9 j if (document.sform1.checkask.value=="") ) |8 A$ F, }5 u' w3 i
{
- P0 |6 X/ J: e" O: S4 z$ v alert("密码提示问题不能为空");
9 k7 } M+ k9 O9 Z4 z- p document.sform1.checkask.focus(); 5 N# z1 I. f& }
return false;
) u" d& X9 @' s: o7 ]: l } 6 Z5 H9 F5 f4 y" i8 i
if (document.sform1.checkans.value=="") ! ?5 ?0 I: d; [+ N X5 ]
{ # `+ I0 ]2 o* t* A/ q9 |5 W
alert("您的密码提示问题答案不能为空"); ' r/ J9 Z4 j6 L1 m$ p0 w
document.sform1.checkans.focus(); & y9 d. k/ f. L! _8 ~& o
return false;
/ S8 E6 M/ {; v* v3 {6 ~* S4 F& c! ? }1 i! X3 h) Z0 y/ y" E1 I
return true;
% m' s" a& E3 |) V
* O8 D$ F Z m% `. l e3 k} 9 C! e- ]5 q ^7 _* D: @
</script> |
|