|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14367
- 金币
- 2469
- 威望
- 1647
- 贡献
- 1417
|
这个脚本对你可能有帮助:+ b y0 j& I3 f2 Z2 s0 T% g
<script language="javascript">
) W/ o. T, k, q0 Dfunction IsDigit(cCheck) 9 y6 Z( ?1 Z6 t
{ % V/ a/ m$ w# n8 c' f0 K2 l
return (('0'<=cCheck) && (cCheck<='9')); 4 O: ?4 q, v1 a9 Q2 l* ^& G1 `
} ; H: J! \& K9 H
7 I, a. L, P" Ufunction IsAlpha(cCheck)
( k% f, k4 d4 K5 G {
" o: Y/ Q6 l. j% S return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 x) o' Y) c: l8 o) i }
! z/ r1 K/ [% f X 5 r: w2 E9 X5 t- ?) ~
function IsaNull(cCheck) 6 r: Y/ b7 I }" B1 d
{
8 I+ n9 ~. b1 D+ W& l/ X/ s8 Q return(cCheck != " ")
( p F P q9 Q }
; x3 v! P; ~: P6 {* B
- W/ v& [& ~! V$ b2 xfunction checkform() ! y) R" G0 N+ U) W' D% y
{
5 O& z7 k4 \1 n. h B id = document.sform1.id.value;
! G/ n4 C/ M& b8 V if (id == "")
. s3 r, @6 b$ ~2 N2 `/ k { $ c4 E) _7 E' W. M+ a& m1 F
alert("请输入注册名"); / P' c1 O: A7 |# P5 x
document.sform1.id.focus();
3 X7 ~# C! o+ P4 Q* T* H: @ return false; 0 ?- B r# P, Z% C& I( v
}
3 U! K. g) x6 d! ]$ M; |# Y l ; D. I1 R+ d9 H% e
for (nIndex=0; nIndex<id.length; nIndex++)
) H+ D! I6 F6 Z3 {7 K5 l {
8 P/ U. b3 I% x2 z7 Y cCheck = id.charAt(nIndex);
b1 C& U: s0 }. ` if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
9 a+ P8 F$ B4 T% I { 8 B( r: @0 k; |1 a+ i& w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); r W) V% H+ }! G, m, ?
document.sform1.id.focus();
7 |, q) q5 Q) D- j return false; 6 o# G* z4 d2 G1 x1 Z7 w6 u S8 K
}
5 ^* B7 d, s3 X& I4 @2 _ }
2 R& \' a( T- k: w& C+ e- E chineseid = document.sform1.chineseid.value;
# q/ P: }0 r6 B- Z0 ~* w* f* _; B if (chineseid == "")
6 [# Z8 P. H" Q. r+ Z4 z { . i# s0 e; A) u% [
alert("请输入中文昵称");
; Q0 B8 t1 N0 t, z9 ^ document.sform1.chineseid.focus();
! U* o$ T, B0 r1 p+ x5 S return false;
, }( F- k, n z5 r, z6 d' S } ) I" b3 h7 m1 B5 @7 q* }6 D& C
password = document.sform1.password.value;
+ l6 d; X: s+ M0 c if (password == "") : c# R- j- f7 E5 ?0 i
{ # E8 u$ }4 F3 Y+ S9 {
alert("请输入登陆密码");
2 v/ s% M0 o+ X* ^ document.sform1.password.focus(); 7 h5 r* N4 r: g8 |" |2 @
return false;
5 P1 a: |3 w- r8 {! ? }
7 _- R2 Q& t% i' n8 E password1 = document.sform1.password1.value;
9 J! ]' ^4 I. ^' n if (password>password1) # l8 k0 H" ^' O6 I6 E3 \
{: A6 a$ f! B8 Q2 ~, b7 g6 J9 D# q
alert("重复密码与登陆密码不相同");
& Z( ]4 u4 R+ S* R$ o. T document.sform1.password.focus();
9 u0 @( G1 b1 h# C% e document.sform1.password1.focus(); " B. g" H# N' O/ A: H# x
return false;2 U* v" u+ n+ I' p% w5 n4 g
} 4 ?. z3 L4 K2 ?0 i
if (password<password1) o6 H$ N. E9 P3 b+ C6 ]
{
& e3 \4 w) v" T4 K alert("重复密码与登陆密码不相同");
2 S2 h" G8 {( g7 B, U2 F document.sform1.password.focus(); u1 m8 ~/ V) U" Q8 I' v
document.sform1.password1.focus();
3 ^. G; B* s7 ]; V return false;
; N* G8 s# } c3 E6 j; j0 i } " n) O+ g/ ~: e: b
if (document.sform1.email.value == "")
7 ^% u K- u. y V+ G* r+ R { 2 U7 }! ]/ ^4 p% z- e k8 E5 j9 G) Y
alert("请输入您的E-MAIL地址"); 4 \, z. R" [9 p$ B. z1 j H1 A
document.sform1.email.focus(); 4 A" {+ v. }, E
return false; : u8 [, H$ A$ G( X: e( t+ @# z3 O1 D
} 5 r$ K9 g/ v* Q8 t5 m/ P# }
5 v/ B6 c0 q/ J
email=document.sform1.email.value;
) i' b0 w* R% z+ p6 v emailerr=0 6 G8 R0 B1 O" O* g- d$ N
for (i=0; i<email.length; i++)
4 Z1 y3 B6 j' R {
5 U3 I; Q- i3 N+ H6 P+ s if ((email.charAt(i) == "@") & (email.length > 5)) 3 ~" Q: {* ~5 j a% G
{
6 u# b2 T0 s: [ emailerr=emailerr+1
& ?6 r+ M- r8 L6 z } 3 J0 S( ]) P2 \7 ^
}
/ j" Y- D: u) ~5 m" Y3 e) ?* Z; q if (emailerr != 1)
- d# B' A |5 l2 l$ E' c0 ?' i6 h { ) z8 S$ e Q% V+ |- V" x: o
alert("请输入正确的E-MAIL地址");
! t0 q2 f( l2 d9 M T7 A6 S document.sform1.email.focus();
$ i9 E, W) X" o return false;
) r2 W9 f% p0 J }
T8 \2 j9 O2 `" l/ I2 F3 d$ B% Y; s & H. v+ Y* T) @8 ]! Z
if (document.sform1.checkask.value=="")
7 T% a, m2 d2 @: R {
# A$ C9 {+ V: g$ u alert("密码提示问题不能为空");
* k" g8 Q2 C7 Q: j% T6 g document.sform1.checkask.focus(); . ~) w$ {9 g9 n" c0 z
return false;
8 A4 S; g; s2 ?; |9 J1 `- D' U } " t6 d3 ?) g* }$ [
if (document.sform1.checkans.value=="")
4 b a, z0 \$ U- \# E L4 k { . J- E$ J1 \* `, z9 w# F
alert("您的密码提示问题答案不能为空"); - j. y" G1 s9 j4 Q' J% P2 W
document.sform1.checkans.focus(); . G' p$ s3 y, Z& w2 V, ^0 F
return false;
" m& P8 ?3 D! K) |; R) e5 P }
" M: l! w/ z; k/ {, R* _. M, O return true; 5 ~# {! H2 i1 s& j
1 [6 F1 |8 x4 e: ~& H, A7 V( `6 d
} : j+ `; v& M$ B! ~, K8 x
</script> |
|