|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:9 u. F, `% q# J$ }6 P
<script language="javascript"> # V0 B0 E8 v/ s
function IsDigit(cCheck)
- ?' n( _8 O: G- ~+ ~ {
! y) K8 w; W8 l0 O4 ]( Z return (('0'<=cCheck) && (cCheck<='9'));
7 x5 V8 M8 k o3 v k, C }
9 C4 x1 u7 _! y# ?+ ? 4 s* v7 e. I, v; D1 r( s+ C t
function IsAlpha(cCheck) 1 B6 o) A' P5 {0 l
{
+ g/ Y& H* j; T6 }& r* Q return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
3 h& c/ t" q e7 u4 Q- N# x3 o } . Q! [9 v7 ~- l! F
. i5 j# {3 I9 ^+ Lfunction IsaNull(cCheck) ; G9 ?" h5 m. L- J( m. x: |
{ 1 G1 J2 p9 J: B( b
return(cCheck != " ") 2 x) P5 M3 j$ l. @7 b; [+ |
}
' ?0 M _$ C. o/ T& n$ i' ^, R% c! y( ~9 |
& U5 ]. m3 r9 N, ^; Kfunction checkform() * E+ @9 J& a2 y# y- q8 p
{
! o `: K1 D6 [1 q+ n& u+ A: E( v id = document.sform1.id.value; # S0 l* M! q: u7 K/ h
if (id == "")
/ Q$ u+ V+ ^( Y+ u3 b: n6 b {
# v. z3 j! I# K9 Y- @; T alert("请输入注册名");
5 ~# ]0 f% I/ q document.sform1.id.focus();
+ _ P( [$ |" t' w return false;
6 O4 `" O' [8 V* o }
% G. t: _/ J& L. n# h
4 b' e# [0 D F( { for (nIndex=0; nIndex<id.length; nIndex++)
/ ^* {6 T1 C7 N6 Y0 r0 C& K { 8 F) D( j3 e: k0 v# l( j( A
cCheck = id.charAt(nIndex);
( h( P- I, d2 |8 c# }$ E if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 7 D2 X" Z7 A5 v% n
{
1 f: K, x( _0 y- O( ^6 X alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); - A, k% O/ a" g6 ?1 z
document.sform1.id.focus(); $ G! w0 g! O5 ~$ X' g; |
return false;
6 b4 C1 ]8 Y1 t; K# L/ s! O }
, M3 l( |! ]% ^. t1 l2 M } $ @+ h' A/ F- j' |
chineseid = document.sform1.chineseid.value; , W5 W! X- n/ w) S5 D
if (chineseid == "")
; G. @1 O9 r) o4 l) q& ^ k+ M { . a8 L0 ~* ` ?; N- C$ X3 [
alert("请输入中文昵称");
. F0 W" Q( X2 @0 W7 K; h: x# V" i5 T document.sform1.chineseid.focus();
4 S5 B; _; r0 M5 M/ L2 x/ }( f return false; ) e0 Q2 J- ~- O- |3 d' N. [& p
}
7 [' {; C% }: O2 C password = document.sform1.password.value; 8 w' r3 G; b M2 V9 e6 m# B+ F# U
if (password == "") 3 m$ d2 Q% r; H
{
8 `, e+ g& x% } `% @% h7 D% K. b alert("请输入登陆密码");
" W$ q% P( A) @3 o2 F document.sform1.password.focus();
. @, x, E6 f4 N2 D$ C return false;
2 h$ O( s8 V* @/ a: l9 ?9 k } & E" c& K$ ]" p4 @+ L
password1 = document.sform1.password1.value; : J* Q' b. _5 z$ P5 W4 X% K
if (password>password1) ; }! a# R( ]8 ^. G
{0 n& }9 V, |- l8 a X6 H6 |
alert("重复密码与登陆密码不相同");
5 C2 h! j1 P" j! t document.sform1.password.focus();
$ T8 q% d* o; B& j- A+ l a document.sform1.password1.focus(); ! Z$ n+ |; j- U' ?
return false;
! u9 \' L1 S; j8 ? }
# `: w, a) z; p) P% K$ d! {# Cif (password<password1) / ] q, z8 }5 J& G
{
( u) C1 z8 D9 |1 i alert("重复密码与登陆密码不相同"); & |3 f6 J- y: v
document.sform1.password.focus();
& p# z1 S) f% M+ X- X, |" R5 ]- A document.sform1.password1.focus(); ( o, F# l8 V, Q1 F8 r0 h1 u* f
return false;! h2 I' h5 d9 s/ h5 G5 ^. Z& U
} & B/ Z% p, R: i( p5 u1 o0 R
if (document.sform1.email.value == "")
4 }" W, A6 l' } {
( y7 Z# U+ X* n, Z$ L alert("请输入您的E-MAIL地址"); + p+ }& P* Z/ z3 Z6 H S
document.sform1.email.focus(); 1 e% [8 p# w4 R# X8 E$ n& @5 M2 P8 S# Q" v
return false; 8 ]$ }/ w% I* H/ a
}
# U6 Y+ r8 z+ L- R2 p 5 C. a) U0 W" a/ y8 J9 u) m
email=document.sform1.email.value; 7 ^$ Y% H4 l- H- r5 Z( I z. q
emailerr=0 : T. `2 j! {& x6 u6 A
for (i=0; i<email.length; i++)
, i9 |- ?' l6 c3 m4 x: } { ; ?9 p5 K2 T; Y
if ((email.charAt(i) == "@") & (email.length > 5))
8 y* |* z- s0 d( N7 G { , K7 a9 z0 h* r$ x' i
emailerr=emailerr+1
% K" C, {% x* d6 r }
6 y9 c9 H J0 L: ] } 8 _9 p- U0 v8 q- ^
if (emailerr != 1)
/ }- o m* A" ]% ^2 O0 w3 w {
" B r) H( w7 `+ O5 _& @$ N3 k0 i alert("请输入正确的E-MAIL地址");
" k& k/ |8 X0 k/ } document.sform1.email.focus(); ' A& t3 _+ \ D
return false; / Q) W0 c. R. q/ t6 C3 R* P2 y) }
} + x3 ~6 s0 t+ h4 G H/ o: w
0 Z5 r& [0 i& y1 ~# V if (document.sform1.checkask.value=="")
3 g% p! @% |: z8 Q' n- e { 5 q1 \+ g5 v3 ?& L; V/ k9 `4 {
alert("密码提示问题不能为空");
0 a. j: l5 s4 G9 G: m document.sform1.checkask.focus();
( [, H! s! z4 v! g7 \7 A4 H2 W return false; . L+ W# v; l! ^( q v, B. t
}
- n7 [! V1 g6 S" f u5 Q8 i% D if (document.sform1.checkans.value=="")
& u. X; n0 u2 ^, U" b { 0 a( M8 }# ^0 S9 U7 X8 C
alert("您的密码提示问题答案不能为空");
% T9 n; U: T" ^/ E( c \' w document.sform1.checkans.focus();
* _6 ~2 N; y' c4 c* N return false; : B: ]! |, N+ B2 Q& P( r
}7 U# g' L% [( `0 r( l
return true; ) w9 U9 }" d) C/ o
; ~ s5 c" E3 J3 k* n, o}
( m9 A; Y$ L0 K& e! m' h `</script> |
|