|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:
* v- r7 r: O* O" ?<script language="javascript">
7 [6 K& y1 A! \% U* A: G' g5 J7 X# x* Ffunction IsDigit(cCheck)
}7 y$ N4 s; e/ O, G) d { f! h4 L3 g6 t" H6 W
return (('0'<=cCheck) && (cCheck<='9')); , S; |! B( S9 J) f& \
}
% W. ~% M; u4 @$ l" x5 \- @ : @$ Z6 P& ]/ h; g3 X/ F5 W, Y
function IsAlpha(cCheck) " ] ]( U) R4 N( b
{ 9 L0 N, W; @6 Q( a5 W
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
# h- p. }) I. J8 Q/ i }
/ c* n z/ f" l' E7 x- F) Y
. I! f7 b, i4 ]& k% _, I1 L9 Y( mfunction IsaNull(cCheck) + h; Z' N1 D; U
{ 7 h5 y' ]1 p: _
return(cCheck != " ")
6 d4 Q4 s- g4 L: M } 9 i/ S+ q! c) u: i! S6 L
* @8 Z! q' m1 Z% o/ Y
function checkform()
+ `) T- a8 ~9 { H' [1 D$ n0 I9 z( ~{ 5 g# w9 S, I D8 B
id = document.sform1.id.value; 8 _9 w( u4 U) E) R- L. j
if (id == "")
2 c' o# _& P. f1 O { 5 o2 h( H6 l% s" @. z# U. G
alert("请输入注册名");
/ @' ?5 C% q: t( o) M: t* N3 g document.sform1.id.focus();
3 }: x" n' N% n, X' `4 \% c return false; * F% z4 h4 b& U$ }5 [# P/ }, _
}
9 z3 H# ]1 \- E2 i) G ) {! D# p/ s0 p- U3 x
for (nIndex=0; nIndex<id.length; nIndex++)
: b; [# G! Z) q- ?% { { / |, K& E6 e3 M, I
cCheck = id.charAt(nIndex); ' y& @0 u! k# e; D+ h+ r* x
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
* V( W! X- @5 J$ d% {3 [$ O c {
. c! s7 m) Z2 b( U# A6 {# j% H alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
2 n$ B G4 F3 X8 h2 A document.sform1.id.focus(); + O+ r: i5 b9 R3 z
return false; / p: I7 ] `4 [9 @2 B% }$ u
} " o4 K4 |, |9 e: d. j C& j8 ^- T
} : p' P& \1 B j, f0 d% \: f
chineseid = document.sform1.chineseid.value; . N6 c' p+ \7 ^' V, Q: c2 n
if (chineseid == "") % T# u5 f& \9 D) ~
{ ' U& y; s- q/ T& _3 T
alert("请输入中文昵称");
: d T# [6 Y' c# o% }8 ~0 b document.sform1.chineseid.focus();
& f) S8 h! k9 H! b9 } return false; 8 r9 N5 n; P) m) X
}
1 k6 L' x7 n* v! n2 t* | password = document.sform1.password.value;
8 Q M# C7 {* J if (password == "")
4 @3 `/ W0 @6 {2 z! \2 o. x { + }% Z5 A$ |5 j: D
alert("请输入登陆密码"); 3 a" I2 q0 L% d
document.sform1.password.focus();
' s- u7 k% m, {! F1 W return false; ' G6 C$ k9 h& y& c9 |
} % Y& K$ b5 b! R; N
password1 = document.sform1.password1.value;
4 l* L% G5 U' v! t. P7 l if (password>password1)
- K/ i( U/ V H3 t% Z c {
6 h, `2 Y" {5 V4 P4 ]) a+ g alert("重复密码与登陆密码不相同"); + R9 \2 y7 F6 D ~) \
document.sform1.password.focus();
0 a! }1 v5 U& H" K8 J( p4 d9 C document.sform1.password1.focus();
& b3 Q# U. w) [9 w/ S5 G) N return false;
' r+ P( L0 h& {0 k& ^( y' b C }
5 R* L$ G) N. F3 j6 z3 v, q% x" fif (password<password1)
. j; u# _, v4 Z, C& Q {
" {0 j# f' U0 m+ U9 U: v+ O alert("重复密码与登陆密码不相同"); 5 H; V1 k y. I1 Z, w
document.sform1.password.focus(); . L0 H7 h: X: B D" Y3 ]: J6 E. M
document.sform1.password1.focus(); 7 i: \' [3 U! \2 s
return false;8 u q! V0 {* c
}
; g9 f) q9 B5 i2 u, n2 ` if (document.sform1.email.value == "") ; P9 y# v$ O* d
{
7 J) V* w1 D4 s) } alert("请输入您的E-MAIL地址");
[6 E# s% ~, i# R5 C. v+ q9 m3 } document.sform1.email.focus();
5 Q% \, K$ E; N! O( A- E1 _" O- l; Y return false; 0 U: f: K$ x2 \, r
} 2 { [- ^1 ^0 A" d
d, P( p, ^$ n) u+ ]) J; A0 D email=document.sform1.email.value;
5 v: Q) L. _8 X* V/ W/ H emailerr=0
: }5 V) O# Z1 W3 G for (i=0; i<email.length; i++) 8 f. Y( N" v. F; y
{ : m" o+ _7 W4 S# R
if ((email.charAt(i) == "@") & (email.length > 5))
1 w4 _* }9 s' ]7 ]& F {
* ~: K/ L$ V4 Y+ [8 s1 h @+ f3 k emailerr=emailerr+1
# j- b( m" x2 T8 q. t( N } 0 O% q3 r4 L" {8 V. x7 K0 c
} 3 h9 E: ~* S$ Y5 L& a' G
if (emailerr != 1) ) Z; Y( e: N! }* D+ l
{
# M% ?/ E. r- i# G/ T& W7 C+ b alert("请输入正确的E-MAIL地址"); + k: J- U% P, e) T
document.sform1.email.focus(); 1 n* H/ n, }) B1 p
return false; " j8 q K1 X" ]% y. i7 V5 `
} 3 m; v7 r, r9 s# M# l
6 v$ B. n ]3 m6 N$ h
if (document.sform1.checkask.value=="") ) ?4 ?) K' d% q) U, `2 ^
{
5 z% H- A. E/ k8 c alert("密码提示问题不能为空");
9 x& y& P, X* W/ U' p document.sform1.checkask.focus();
) L' b) B* ?9 [0 r/ X# x- S return false;
& Z9 L# }% R$ t% p' @ } % d' C% U: \8 w+ m* ^
if (document.sform1.checkans.value=="") 1 i2 f- z6 x8 {9 q J0 o
{
9 L: g. Q! F. Z) P- q alert("您的密码提示问题答案不能为空");
6 p$ F, F. W |. w9 O9 _* Y3 o document.sform1.checkans.focus(); + e) N# u7 @: V
return false;
; e2 p; }* j7 }, z }
: Y3 a; `; F2 z0 R/ i return true; % \" d, p) E" y, b3 e
/ s# W9 f/ Q; e& Z2 g/ M}
5 `& C/ w5 i m' U. t</script> |
|