|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:& \ I2 ~5 H. i$ ]$ _8 x2 i( X
<script language="javascript"> $ X; ^6 Q. Y+ B- A' ^
function IsDigit(cCheck)
7 _0 W( v, p# e( S3 Q/ Z { 5 U" m& @* {! Q7 H* H, b; `
return (('0'<=cCheck) && (cCheck<='9'));
E. t8 ^% u9 \3 n6 y- i! S( I } - _. R2 q% Y4 H# @6 I" Q* J
8 ]/ m" g2 j& l* d# l% `function IsAlpha(cCheck)
5 x( \( f% C0 i0 e { ) }% P/ s2 i: w& |
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
6 P/ `7 L6 r3 ?* H# f& W }
8 H. b4 Q9 `5 }$ j " m! O7 G$ X0 p4 J% D/ {
function IsaNull(cCheck) ( ?0 T T) o+ ?
{ 0 z6 r, m% I+ T" E6 ]4 J7 b: G5 J- t+ o
return(cCheck != " ")
# j* Y& O4 K5 @ }
/ o# l+ J: o) n& w ! [% ?9 n, ^2 t( v: w+ W/ i6 [
function checkform() - o# P: t1 \# V. W' t) Y' l) c
{ 5 x; }9 F5 ]; `: X
id = document.sform1.id.value;
) P1 U: Q: O0 X# o) y& [- k c if (id == "") " R2 @% d7 g3 J/ L' n% ^
{
& ~8 V' h d" C1 f7 g6 e alert("请输入注册名"); $ Q& m7 V3 e) S+ D+ W8 v8 j
document.sform1.id.focus(); " Z; r2 g, W( d; _% {+ }
return false;
" a9 H! E$ O' F6 j7 ^ }
- \: [+ B, P1 _, ]6 v9 d& V % k8 r/ c: {- j) P; S" j& F
for (nIndex=0; nIndex<id.length; nIndex++) $ K! x" E% r4 j+ @$ i
{ 9 N1 J7 m! N5 v+ S# Z9 Q1 }1 T
cCheck = id.charAt(nIndex); % m2 U; a8 O3 Y) h: x
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
0 v1 t" k9 v/ w$ I {
) G. @0 ~! l* V8 [: P3 C alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 1 }# S; Z9 M8 i/ A1 D; L, m
document.sform1.id.focus(); * r! I% C( Y( Q) a
return false; 6 \2 l8 T4 t5 W2 b1 a# W) K+ b- i
}
6 \: b9 g" O7 h% c }
" N4 k+ E0 @8 ` chineseid = document.sform1.chineseid.value;
+ X. X6 ~5 ^0 F3 c) q# @ if (chineseid == "")
7 S$ w* S3 f6 B {
0 i4 j7 q8 A" p: S0 } alert("请输入中文昵称"); ' s0 }3 {4 H2 P/ V }+ T& L1 ]
document.sform1.chineseid.focus();
; h4 D. a3 m1 {# X3 z# O9 r return false;
# [: o# g+ O6 Q1 l" r- b }
O1 e3 I1 h4 _6 a( m, k password = document.sform1.password.value; 9 E5 l* g1 `! h
if (password == "") / e$ H9 X9 ?8 \8 j+ s* q Z
{
( H8 M* @# }/ C6 @) f0 U# R alert("请输入登陆密码");
! G( j0 F& N( r& `+ L2 t/ I document.sform1.password.focus(); 7 {2 @) d1 i$ J8 d; T( G* F
return false;
- b/ C( e7 [$ ~6 a9 ?7 f7 O }
' t) R! @; ]8 P7 g" E+ l password1 = document.sform1.password1.value;
+ p& E) y' U* Q9 S if (password>password1) 2 C+ H* M* M C' k2 {
{7 T" W4 z+ E7 ?) ~' ?5 x1 K
alert("重复密码与登陆密码不相同");
0 `4 Y; \) l. l0 l document.sform1.password.focus(); ; \3 V! H1 {6 L* a$ Z+ Y
document.sform1.password1.focus(); 0 J, ?$ O/ X) E+ W1 x- R/ e5 U$ i
return false;
; C9 ^& H# f% w) p1 S }
+ C# a' r& Q; t9 k8 }, ?$ C& k3 Gif (password<password1) / l1 u$ G- `4 w8 |- L$ x
{
+ Q: |; ^/ l% {( r& e$ M8 W* I alert("重复密码与登陆密码不相同");
N8 \: t! n- u4 J) N- O document.sform1.password.focus();
" u3 V5 z$ L2 C+ n' h document.sform1.password1.focus(); 8 W0 d i, {$ x7 f
return false;
$ {, ~/ i/ e7 O2 B$ v }
# J1 J- B8 b1 g+ Z. x if (document.sform1.email.value == "")
/ H- i( s' G/ C3 e& _4 z: B {
: W, l0 R w: ^6 T) f alert("请输入您的E-MAIL地址");
% `' _$ v$ L9 J- C document.sform1.email.focus(); 5 i0 n3 t" c& S2 D
return false;
; D* J ]4 t- ^ } 9 O$ T3 U7 m0 d; |# H5 k1 W
7 u9 S$ n! r+ m6 L+ m- u
email=document.sform1.email.value;
% F# Q" L3 I" ~ emailerr=0
( t, ]3 A! k; }0 ~) m for (i=0; i<email.length; i++)
9 z" s9 F2 I3 _0 s0 o {
& c/ W9 r' ], }, h: F3 u, | if ((email.charAt(i) == "@") & (email.length > 5))
2 x. ` |4 R4 ]3 } { & `! U: [' {* f& A2 y: u
emailerr=emailerr+1
/ `7 d) V; h. A }
( ?& B0 f3 {( m6 g1 o% X }
* g, E: K+ u; v/ a& J if (emailerr != 1)
2 P3 m+ N" p2 }- X { ' z q, g* t) r& ^2 H
alert("请输入正确的E-MAIL地址"); 3 ~ J: P" c7 H* K8 h
document.sform1.email.focus();
& z! x/ L2 j( a1 D5 A" e return false; / X6 H+ x7 w o& [3 P* b8 R
}
* Q( ]6 y v8 |" G
0 G0 K3 G0 Q- C6 o. s: n if (document.sform1.checkask.value=="") 4 v6 |9 h1 O+ Z& p# P, X, p2 j3 _
{
4 P1 ~" \( A0 b d alert("密码提示问题不能为空"); 5 V" w6 @$ b' @$ V' h
document.sform1.checkask.focus();
- F$ q9 J* k: i# B+ { return false; 9 y: R& q: k3 @, s! N
} # A- e9 h* r& v, P& |1 W7 x
if (document.sform1.checkans.value=="")
/ v/ x+ P- H$ j( w2 y8 K W, `% n {
+ V6 m) o0 a5 E- L, |. v: w, d alert("您的密码提示问题答案不能为空"); 5 j: j; l: J4 k% b. @. t
document.sform1.checkans.focus(); 3 }, O0 ~- ~! c6 y U) H0 E
return false; # {8 l: }/ y2 B& e* i
}
) E; V5 _% x, K return true;
. G; M0 f+ ]$ R0 i, N! ~/ d4 c; T
' d1 f6 o. S; c! q: y1 D- }: Q2 a# S}
; s) b, e# r$ x( W</script> |
|