|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
这个脚本对你可能有帮助:
}9 o r$ o" ~. f<script language="javascript"> ! a9 M2 O' @' L7 }# K2 \
function IsDigit(cCheck)
, t7 t; g. w/ C3 X { 9 \# V0 p; x1 M7 J2 }7 i
return (('0'<=cCheck) && (cCheck<='9'));
; `* \( P2 [3 B! ? }
4 E) f# @% b6 O; s4 C. t + M6 U$ }% K9 B( ]9 I
function IsAlpha(cCheck)
{& C- V4 @+ l p9 O% b { 8 O4 o9 w0 y* u# l! D
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
: V1 p* @7 ^6 e4 k }
1 H3 D5 a2 k) M9 [* m' v 1 P3 O8 e( I/ o v/ G! V# I; @$ R9 i
function IsaNull(cCheck) 4 y3 X* q* |) U, M" n
{
( o$ t1 @ e7 Y, s% D! a" f( Y return(cCheck != " ") 5 B+ I9 P2 p# _* J @9 J A
} & n* q$ l' T: N" R! D3 P, h
5 d: K* i$ e+ W: A0 b) @function checkform() 3 ]( I/ C+ j# k% f3 G
{
. R$ V3 v I3 Q8 s% g& L id = document.sform1.id.value;
6 U& U/ v( f: D5 a; ] if (id == "") % e- J2 H9 R8 G8 ~
{
$ n6 T+ E$ f1 U, m' m alert("请输入注册名"); & y( g5 f3 s* B) }$ F5 l5 c' g, H
document.sform1.id.focus(); 1 |/ \9 c G* v9 O' d
return false; 6 u3 ~0 R- {+ S. F6 K/ A
} 3 w4 z$ ^ ?. ]2 _
. O5 O* Q( y' u) Z; v0 ^
for (nIndex=0; nIndex<id.length; nIndex++)
2 e( Z/ D8 R- t r. f3 ^ { ) d% W! o3 N5 U8 Y' g) C
cCheck = id.charAt(nIndex);
O6 K h3 M0 {: S' ~3 c if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ) J2 l$ J0 N1 R4 i0 e
{
0 q1 u& _4 W) D alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' x& E* O3 n4 q) o" P document.sform1.id.focus();
* {) ]9 f1 J) }& G+ O: O" t return false; * m6 ]% M4 x$ j- U4 t* b
}
% M6 g' o7 i% m4 `8 H1 n }
. T3 U D- v6 Z1 L7 p/ q! Z chineseid = document.sform1.chineseid.value; ; s7 O- b2 r* E: F9 z1 | |: W
if (chineseid == "") * D; B* Y/ v" }2 n9 C6 [! ?+ ]8 ^! ~
{
U, Q( Q% U0 d0 m alert("请输入中文昵称");
/ a- X1 {# y: M! c' m x3 ] document.sform1.chineseid.focus(); " {/ l0 |7 d1 E
return false; * d O( v3 x! U) e" \+ l8 K5 i
} . T' J. ?+ {1 Y9 O8 c# \
password = document.sform1.password.value;
4 U% p2 l3 J) H9 @- l' v+ o, R if (password == "")
) l! K3 o- w+ f$ u5 _! e {
! r7 K9 |* Y: Y+ i; e. L alert("请输入登陆密码"); 7 @4 k, W( {+ A& A
document.sform1.password.focus();
& s* k- g v6 q$ |' d$ e' J return false;
3 B: d$ G& M+ p0 g: Z* f }
/ |! b; V4 B1 r: f password1 = document.sform1.password1.value; 0 F2 Y, ? l& y0 w' t4 r
if (password>password1)
9 x1 U& P' ]1 M4 F' F4 ? {
' k2 `& ?3 s- N- N7 d alert("重复密码与登陆密码不相同");
' {7 l6 e. M% Q6 m1 B document.sform1.password.focus();
( C( i% I. X! l+ u9 @! L4 ` document.sform1.password1.focus(); , K3 m) l- m2 d* W
return false;
5 f' w$ P. | b$ _* K: M* k } 4 _ B: L$ V$ k/ J$ T( F
if (password<password1)
4 R0 h: _& q* I! n) @ {
4 J4 v) R7 l) { alert("重复密码与登陆密码不相同");
. S% g o. U; K) A, d* x document.sform1.password.focus();
- H6 N$ U- I3 X' s" h4 Y( x document.sform1.password1.focus(); % Q# b: q! x; F% Q- K2 P/ ~
return false;- _; W0 \2 E6 {9 q! @" J
} : u' K% S# C! M0 R' N$ J s) C) Y) v
if (document.sform1.email.value == "")
+ |* t2 j/ X" |0 s {
" u& s+ Q/ f( [6 X5 Z% o6 |/ D alert("请输入您的E-MAIL地址"); 8 ~% ~! C) z& S# S9 ?
document.sform1.email.focus();
$ t) d) O; {- {7 w# e3 n return false;
* U' x( |9 c8 x! a/ Q! T0 B }
: U) C& x& ?4 m: c
0 g( {! _1 {/ {2 o email=document.sform1.email.value;
1 g) `2 O4 f: j- V" L emailerr=0 9 ^& y! q% o% _! @9 Z9 ^; I1 b
for (i=0; i<email.length; i++)
; s4 g- ~; j6 F& m" { {
2 f& b5 o) g3 A8 t& ~% \9 k if ((email.charAt(i) == "@") & (email.length > 5))
- k- {! j- t7 |3 G* C' _8 V9 F { 0 a& [+ M, n7 G7 W1 E
emailerr=emailerr+1
3 Z5 K2 u" c O$ p4 d" V. k/ Y4 n. p } ) o5 g, t& K8 M/ G6 U( d3 ?/ W
}
. L$ m& |2 \+ h9 B4 Q& [$ x if (emailerr != 1)
' x- u8 R, h/ a) S8 q$ _ { ( `: E1 o8 b5 U" O, f: Z9 o
alert("请输入正确的E-MAIL地址"); / [) x9 _3 A) e' T7 M
document.sform1.email.focus(); 4 ]5 h) I% [6 F; F3 _2 z
return false;
+ G; s+ S' K' V+ T }
! P7 }7 X b3 } G* N5 X
0 S1 s' j9 A F4 h- T! I if (document.sform1.checkask.value=="") 7 W) b0 \& E6 @+ a. u% q% z1 O, F
{
1 C) s: [3 B4 j* @5 q alert("密码提示问题不能为空"); ) \: \: @* v$ m* U6 q0 h( K
document.sform1.checkask.focus(); , V u- y0 w6 Z" e6 |% J: Z# t. [
return false;
Z3 E0 K; d: i3 t2 G" X8 q! X }
" W" B: G# _3 Y7 X if (document.sform1.checkans.value=="")
( F# g9 v- M" I {
4 @4 }# N7 ?/ ?6 P" K' R- P) U" m0 [ alert("您的密码提示问题答案不能为空"); . s- y0 y4 b* \4 C; j- ?9 l) u5 ?
document.sform1.checkans.focus(); / i1 ?) M* `) R3 {& y
return false;
E' T: l& V R }
/ B1 r9 Y3 S9 \$ O% w return true;
& [, S( B9 D' {# t
2 x4 e3 b2 V) S6 l} * Z7 s" g. Y0 V/ `" L1 }8 d
</script> |
|