  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
这个脚本对你可能有帮助:" S8 a4 }$ ]% ~4 h" x: R! U
<script language="javascript">
4 ]3 U% C* h$ S# t5 L( T7 \" Nfunction IsDigit(cCheck)
2 x8 e3 G8 t z: y% H {
$ i3 K8 I1 c# I& T7 \( I return (('0'<=cCheck) && (cCheck<='9')); 1 x$ P0 K$ Z0 i9 ^) s, C
} - E7 R- m a! u9 D4 _
3 A' n# L! J7 x0 bfunction IsAlpha(cCheck) ) `2 |, y6 d9 w$ \/ d
{ 0 d2 J" s& w( u0 N
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
$ ?2 i- N* ?* \- B; P( y; r } 5 V! F1 ~+ W& W9 l' S! k$ `
9 h3 ]" O: U$ B6 d9 A6 Xfunction IsaNull(cCheck)
/ B7 O& E3 q- ?5 @7 E { ' ?" l z" K9 t: {
return(cCheck != " ")
U, ?2 l' m. P }
' p; B; B: t- b/ k( x, Q) J
3 [, k. a. m% \4 q: X" sfunction checkform() K# R# `5 j9 H3 R; W8 f: P2 b
{ # x& b6 \* J4 S: D7 v
id = document.sform1.id.value;
9 S% G5 \+ U) \& } if (id == "") 6 K* A% o2 ?" h4 [
{ 2 k9 S7 \2 e% Y$ D+ Y" K* }
alert("请输入注册名");
0 ~# g/ b5 h5 q; ~3 y document.sform1.id.focus(); " J" L. o: N1 I) X3 t! E @2 F7 ?
return false; ! i- b! A* z) F8 }4 c+ K
} * Y" P7 @& t/ i
+ f5 p% A+ |4 ~- i for (nIndex=0; nIndex<id.length; nIndex++) # c3 J# [& y1 O+ N5 O- H
{
$ `2 [5 l- \; Q8 E X1 u& n cCheck = id.charAt(nIndex); 5 V5 ^" Z% `/ v0 p
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 2 e. `" A4 w; V: j4 V+ I+ E
{ i' K' y, b9 g
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
2 e( m2 c! c h. W( \ document.sform1.id.focus(); 2 ^+ i# b4 E% ^; [8 W! U
return false; 0 s& T) S O5 n4 p
} & ~% ?/ X( L0 A/ h% F9 d( w, j
}
( C; q0 `2 v* S9 l* N) } chineseid = document.sform1.chineseid.value; 5 h3 |2 H! e; r- k
if (chineseid == "") 2 J) t' V: ~8 j
{ ) A) R6 i( U* j8 f* e- @* G% F$ Q
alert("请输入中文昵称");
4 V! i4 }- \" ~( E& a document.sform1.chineseid.focus();
: q. k' B2 J. F" C, q, ~ return false; ! i/ i( s0 g: {& V: ~
}
' b9 z) a9 L( \1 J0 _ t. h& w password = document.sform1.password.value;
6 ?- V2 Y8 E0 f# h if (password == "") % Q, {& v* P% K
{
2 r8 t! |# ~; z7 Z alert("请输入登陆密码");
. M. k' [$ U. F# C document.sform1.password.focus(); 0 K2 \3 Y. N; f" `/ b' k t
return false;
* ?/ f B# [2 x; Z3 P } : @8 [8 r3 |) [% r1 |
password1 = document.sform1.password1.value; " b4 G$ E4 U: T# h s5 m" G# }8 J
if (password>password1)
# A0 e) U& k" t) ~0 R {
& ?' H% G& f7 q4 U* s alert("重复密码与登陆密码不相同");
, q) n0 M V+ `3 D# l- ~( v document.sform1.password.focus(); + O6 x8 \( ]( t0 g$ h' a
document.sform1.password1.focus(); % w, _) m2 @" H7 ]( o" M) a
return false;
7 i# G: A6 j8 b P2 ~9 ^. L }
+ P" {# C% @$ f* F# W( x' S; eif (password<password1) 6 U0 v2 r% \" S: L' ~% B
{
3 e: y- D* \9 J. k, M" V5 V& o1 h2 n) x alert("重复密码与登陆密码不相同"); 8 H8 i9 c& J% ^6 Q2 o# p) x' \
document.sform1.password.focus(); ' ]9 U, o6 N2 {: N, U9 g: u [. _
document.sform1.password1.focus(); ' A) z/ H% O+ a3 |/ v( F# d' |
return false;
, G8 _ G9 S# ^- t. o } 1 i2 C$ }& P/ y
if (document.sform1.email.value == "")
/ B& G' A! t; V7 @3 ~6 ^9 p, o { 3 I4 W) t5 C; o7 _( O+ w+ B
alert("请输入您的E-MAIL地址");
) n. n! }/ Q q( j' h document.sform1.email.focus(); : j1 r2 I6 I9 [" } H
return false;
4 A4 T5 E+ ]' \ } ; x/ s2 d* p) N: \" ?3 v
1 Z, m: T$ ^1 \/ B8 w email=document.sform1.email.value;
5 @0 {. q, o( U emailerr=0 8 i4 \, O1 b3 U0 U; d/ X3 t- k# G0 P
for (i=0; i<email.length; i++)
: R: H2 f& W% n: a& e {
+ q6 g7 ]4 Z) L9 [ if ((email.charAt(i) == "@") & (email.length > 5)) 4 k* l2 m# Q" c# V
{ + U6 d+ \% Q$ P2 f8 V2 b0 U- Y$ {
emailerr=emailerr+1 . _/ Y* e2 L6 c
}
+ T) r' x |6 l7 k4 o } ) t. @+ G" M" I. U! W5 V8 f
if (emailerr != 1) + U3 U3 X& I0 ~( t
{
- e! x9 }7 t$ y& C alert("请输入正确的E-MAIL地址"); ) [& O- j. B7 _0 S' @0 r
document.sform1.email.focus();
, w7 F; Z; m0 d6 E$ x6 E& C2 i return false; 9 g/ N$ z6 L y# W( ]
}
4 I3 Z. J( Y9 d. e! _5 L( T0 ^. `
/ w" k0 h2 f$ I& U: p if (document.sform1.checkask.value=="") 9 i) W% {. O0 ~/ y! |/ j# ?) H
{
8 j& D8 @' ^4 I1 U) L0 P% Z alert("密码提示问题不能为空");
0 h5 p/ J' t. }( M" y) X document.sform1.checkask.focus();
# X* h2 O9 u- D" \" x return false; ! m9 J o3 `0 u4 D- T. g! K
} & y$ f5 p+ w5 @
if (document.sform1.checkans.value=="") , _9 V& V$ i5 H( `8 v: o3 E! T
{
. D* h& Y6 p: p2 F+ ~ alert("您的密码提示问题答案不能为空"); ; p( O4 B% I# X3 ?7 z
document.sform1.checkans.focus();
/ s# E4 F* w7 v1 ^ return false; ! z9 i) r8 v7 G7 r0 }# S
}
1 X& t$ H5 b0 f+ D4 J return true; 1 t7 E) k" D7 m
1 `; M. N" u. a/ u& H/ e
}
) B; F$ Q0 Q. C7 d* e</script> |
|