|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:
0 N/ x! U- I' n<script language="javascript"> " C# l& ^$ p6 F' R* s' |5 M! r
function IsDigit(cCheck) 3 S: ~" m P7 G+ n% u
{ $ Q) Q6 j! H, C+ X
return (('0'<=cCheck) && (cCheck<='9'));
' L* ]3 P k1 @6 b5 n } 6 s6 I9 [/ v/ x8 J ~
1 ?3 R) V7 j, D$ F' ~) Bfunction IsAlpha(cCheck)
. F. B% c5 ]/ Z {
2 V2 k* y& r* [) a, o% `# z8 P return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 F0 M, M' v8 v( E
} " q; \! | r+ I9 h0 N& u
' i* h2 i; P* A3 |. `! u
function IsaNull(cCheck) 3 C5 |( ^4 [, h3 o6 G& B4 N
{
5 w6 d; a3 f* h" K* S return(cCheck != " ") $ @4 V' x {/ Y+ u! \3 o
}
9 e, f& c, I T6 O3 s
5 Q! w+ ]: _% K, B: pfunction checkform()
+ O. P B% y& u{
$ s, d J0 Y, l/ _4 T id = document.sform1.id.value;
+ A/ h9 w" ~, M8 { if (id == "")
! ?4 M7 L) G6 `- A' S4 ? {
" U9 V6 T0 C) ^& n& t% ^ alert("请输入注册名"); ! L* U- T9 u8 C) |
document.sform1.id.focus();
I; P i3 W& X* h return false; ! d3 O) Z. R3 d# O6 o7 Y
} 1 ^0 t7 G3 s9 F- S- K
" Q# Q" b9 D1 B- Z; A; n
for (nIndex=0; nIndex<id.length; nIndex++)
9 X$ u- @0 Z: h, Y. ^/ {: G {
# b6 N8 ]- K! v cCheck = id.charAt(nIndex); ) l v3 T8 \9 V1 B/ \
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 5 p; Y! O% H2 ]* ?8 s
{
( Q) e4 K: X5 B/ i2 C. C$ n6 x alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
6 Y2 _( a- Z0 l1 P5 _3 ?; I9 Z# u4 Q document.sform1.id.focus();
; P) R) J8 \% K7 e' P ]9 \5 o I return false;
1 H+ c7 l6 w+ T" ]) _$ L } ' g, N2 U8 x+ c+ W" y! ], k
} ! @5 s' d4 ?5 @+ M7 S: K
chineseid = document.sform1.chineseid.value;
& h+ m6 k8 ~8 ` if (chineseid == "")
1 U0 w D; @( A" i5 W8 [) A. ? { . }4 E/ G. }$ j8 K+ A5 x
alert("请输入中文昵称");
4 ^ ~* Q) m' \0 ]! I3 h document.sform1.chineseid.focus(); r2 d) e& ]& v
return false; & B: f0 I: R9 P- m4 N
}
. c8 F8 d6 S7 @4 v, M, H password = document.sform1.password.value; 9 w* O, m) k. Q2 a* B, n9 g
if (password == "") , m+ H6 {4 I3 F7 R5 M# Z6 \
{ 8 _* o9 `8 t D! S
alert("请输入登陆密码");
$ ~( r- ?9 y$ q* ?2 V document.sform1.password.focus(); + ]1 a& T- u: M5 ~: I
return false;
- S, b1 X- m. A }
! Y# U: K4 a# |; V7 D7 h0 G0 s- [) s password1 = document.sform1.password1.value;
* z4 {1 V. V8 w7 t. D2 f: { if (password>password1)
4 q4 D& [; E) ]4 J {4 N3 X5 |3 z/ }/ i; p
alert("重复密码与登陆密码不相同"); : h/ w% }& c5 Y3 f# O" Z* ~; {/ @
document.sform1.password.focus();
% a+ N1 j3 M; k# |8 ]( c/ }/ G document.sform1.password1.focus();
: O6 l. ~1 {6 |3 N return false;
8 H9 f7 n* {" ?: b } " Y0 ^4 r, V. J
if (password<password1)
/ o& D* V- J4 a& F% _. E9 P% w {0 ^: |: `" a6 R) u$ U- \
alert("重复密码与登陆密码不相同");
- {, L& n+ U. K. Q/ ]0 F document.sform1.password.focus(); 7 S7 {# p. f7 x1 X6 U
document.sform1.password1.focus();
; b/ n5 L7 p; k( A, u. Q& |( \ return false;4 H7 L7 \5 F' P
}
+ H8 t- \/ F6 o% f, {8 j1 T2 R. @ if (document.sform1.email.value == "")
8 q- j& B/ v) B" X4 l5 P' h7 I {
& ]. r# `) e6 o! Q: E$ e# j& {7 k alert("请输入您的E-MAIL地址");
2 k" m) p) N( X' C7 ^3 R document.sform1.email.focus();
; R) M4 z7 ~" e3 i* i return false; 3 ~) _+ h% i2 ~7 \7 M: t
} $ ^2 r/ y( `5 q) K
& e) Z! G |; C! F: A9 Q
email=document.sform1.email.value;
7 w/ }+ B0 ]+ U: J5 ~, a' v emailerr=0 " j# d( \5 T: d. [
for (i=0; i<email.length; i++) 7 [1 P, h3 o! Q4 x0 z/ N
{ a1 c$ c3 o, W8 q6 w
if ((email.charAt(i) == "@") & (email.length > 5)) 9 G/ C. {0 o7 Q: g( n
{ & p' e& ]+ J7 v8 c" P* x7 W& a
emailerr=emailerr+1
( V* Z8 Z" G& R | }
8 G" s9 ?7 F- b1 Z, r' ~7 N* i; [ }
( I& h" _- z9 A- r- j: S: o if (emailerr != 1) / d( L! t& t( E+ _* d) W
{
( f1 I4 z' E7 Q0 g/ b) G alert("请输入正确的E-MAIL地址"); # G _' d- f$ ^: j$ N$ T' R
document.sform1.email.focus();
3 v( [: E, f; Z9 u7 j1 B return false;
8 p( L" E+ W* {5 Y8 A) F! y$ D } 3 s1 S; z0 ~" Q% R
: F- a C1 [# q3 \
if (document.sform1.checkask.value=="")
! M) c t5 H! k8 L% @ { 9 O& M- i7 O; |$ h: \
alert("密码提示问题不能为空"); 6 h- H) |* ^* P9 M
document.sform1.checkask.focus(); & M- s- j1 a* X- A! h
return false; " d ^6 a! M/ H$ K4 [- b6 M
} . l0 q9 w/ A& ~- Y; A& u% c
if (document.sform1.checkans.value=="")
) L1 E6 F: M& L& X0 M { # x, p) |+ f3 r! M9 q c& f
alert("您的密码提示问题答案不能为空"); - F+ S% d/ J- z
document.sform1.checkans.focus();
5 V2 g# [ G% Y& \5 P return false; + C. Q* g _) ^4 u% y/ N8 b
}# B0 I! d/ F1 }' h6 b0 T2 z- K
return true; # \, w! e7 D! E( k; Y, Q
; ]* a# M! _( _ ], u}
* p ~# w' C8 d& O0 _3 N& K</script> |
|