|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:
1 {5 `. Y; Q8 G8 A9 [<script language="javascript">
9 j% c/ s* V3 y. Wfunction IsDigit(cCheck) * A' U0 j3 Z+ M
{
7 r- r5 f& u6 i: h* j5 g1 ?2 v return (('0'<=cCheck) && (cCheck<='9'));
- ?. @; p! ]& e* v( A! ?) o- f4 ? } & z7 b& T8 X Z
6 K( ?/ A( H1 Rfunction IsAlpha(cCheck)
5 q( u; Q$ U; ^5 w" v" z" D" u {
9 e# A' _6 L# C- C# m* g, l return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 k4 }9 @3 a |% f }
# Z6 d7 ~# Y8 i & ^% r3 f/ G$ D1 N
function IsaNull(cCheck)
0 n+ [: F/ z4 o X R6 [ { 1 g- [ F T8 U
return(cCheck != " ")
! {+ k8 f1 }2 Q1 L2 `5 g0 F }
* Y, R" E* e& X+ z6 |6 q 0 n6 Z2 _; r H
function checkform() + ]. P8 s. w7 q
{ - h/ F u* v8 K
id = document.sform1.id.value;
7 Y9 {! K" u+ l7 ?7 k( C) O if (id == "") % ^* [" U5 c" G! o8 Q
{ 2 K2 t* e5 A- n' F2 B, h3 B) ]+ U
alert("请输入注册名");
6 M1 _3 u: H# q6 s3 N5 ` document.sform1.id.focus();
5 q& H0 o( K: i. _( h return false; 2 d; u$ Q8 O$ n. h# m9 G
} # ?% C( [ W& |8 e4 c! l0 b! E- t
$ N; R! m! G* S4 s( m# f7 d2 q# G for (nIndex=0; nIndex<id.length; nIndex++)
# q1 F4 Z7 B+ `" s' z! J9 k {
: g$ B/ E: Q* L' K cCheck = id.charAt(nIndex); $ e% b* ^7 ^* C# a
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) % m" r: w3 M5 S* j: l |' b& O
{
( D$ \' e8 e1 I' Q0 \; l alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ' d( ^0 V2 d$ a/ ?& V6 a, L5 g3 q
document.sform1.id.focus();
& g& u4 J3 G% D return false; ! o8 r% s' `5 a* i
} 4 z, v/ B' V! N4 w* Z, t1 z
} 5 V2 N5 T t! K+ c
chineseid = document.sform1.chineseid.value;
# L2 N$ B7 K, q0 R if (chineseid == "")
" X" e8 V: l* z7 v% ]0 b1 o: | {
( X& y( a/ ^$ K) R alert("请输入中文昵称");
* S; b0 P, H6 H8 q- m0 H document.sform1.chineseid.focus();
9 s" d7 X$ |4 [0 Q+ o return false;
* }8 V8 W& _* n: G- x1 P9 t- w }
# v0 U5 x: v" Y password = document.sform1.password.value; , D+ M7 T3 Y3 N. u+ F1 M6 I
if (password == "") ) ^3 U6 _4 @* {1 v9 X3 t, g2 f( K8 {
{
3 I5 }! S; Y+ K2 ~& x& Y) ? alert("请输入登陆密码"); * x% q7 [( x2 Z0 T/ J' A2 u
document.sform1.password.focus(); . B+ \. @. E" h) _" F
return false; 2 \( u: u+ k' I* E, ]
} # O* Y: _# g/ |7 P/ A7 d+ V
password1 = document.sform1.password1.value; ; K% A9 R K, V9 h( ~+ y4 h) {7 U
if (password>password1) ' A" g1 m: b0 F; X5 v; V
{
) j- B; y8 J$ R" y X; Q$ r alert("重复密码与登陆密码不相同"); ; k4 p8 N; [, V" V" w6 ^" ~6 C& g
document.sform1.password.focus();
0 u0 m: s( r4 J3 W3 a document.sform1.password1.focus();
/ T% j6 V0 Y2 t0 w: W return false;8 d, h0 `' z) V. {. d" O. D" M
}
3 ]% C+ Q( k0 p4 h$ x# w# dif (password<password1) ; p* C6 W' F0 m
{- A! r% r I5 i, U# o* J
alert("重复密码与登陆密码不相同"); $ [* y7 J( }+ H8 {
document.sform1.password.focus();
1 D; `+ f) y' U! k6 Q- g document.sform1.password1.focus(); ( v# X" f0 L1 U/ t: P3 T
return false;
' y- [. i1 i9 A } + H3 X" m9 P7 T, b
if (document.sform1.email.value == "")
5 o* e- b) Q6 X {
, ]( b$ a0 r+ [5 w; n: y" P alert("请输入您的E-MAIL地址"); + y6 C% d2 R2 |! G- j& K2 F
document.sform1.email.focus();
% P x! \4 b; _, n7 K return false;
; W4 s1 [5 Z$ ]6 G- J; G( c }
( L; J+ Q! W' S' j y. T 8 B4 g; P. k- N1 U# F& S
email=document.sform1.email.value; 2 B/ T7 R& I* z6 M( j0 j$ c8 h v
emailerr=0
& H$ Z. y- G$ K% B# P for (i=0; i<email.length; i++)
9 h/ q9 a% a8 T" H; G, n* D. A+ | {
' h" P8 D6 N, w [. b7 S: t if ((email.charAt(i) == "@") & (email.length > 5)) 2 E3 A6 l8 R" q" n
{
; B- x6 `3 L9 w* r+ j( f emailerr=emailerr+1 % q2 u w; Y9 j' p0 V
} : L7 M4 O. D3 z# i
} , Y- x" {3 [ b9 P2 H5 [
if (emailerr != 1) 9 L. n+ V8 H W; j+ [# {% l* }! c* D
{
, H# P3 W2 Z" h alert("请输入正确的E-MAIL地址");
2 [. s) Q3 _! q/ s R# p document.sform1.email.focus();
: ^) S/ o* x8 N8 c3 {& o return false; + ~: k! {$ t: c6 `2 ?2 m
} 9 s$ E5 v$ Q% a }
% x1 R: @9 `7 N2 l9 [ if (document.sform1.checkask.value=="") ! U3 W. `# o3 o, Z7 r
{
! b" r7 y5 u& G& J alert("密码提示问题不能为空"); ! I3 @% r# b" |4 M
document.sform1.checkask.focus(); % O% A; {9 y! P& ^
return false;
7 r# s% O$ G- l } 0 J! C8 v: x [. T5 q- S
if (document.sform1.checkans.value=="") 9 D( ^ j, t g
{ ) s4 z3 B4 }! M2 M, d" q1 ~
alert("您的密码提示问题答案不能为空");
5 \* e6 W" Z" H, I document.sform1.checkans.focus(); 9 _( W( v4 D e% x
return false;
$ \5 Z$ L/ V1 r: e: }1 g$ Q' b0 ~ b }/ c& i! ^/ a2 o- y N
return true;
0 z6 Z* y S9 w
" \1 \5 Q, _+ s/ X9 T}
1 ?4 x! ~4 H( j+ x. \</script> |
|