|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
这个脚本对你可能有帮助:+ _) ~9 ?) l% X' X. S/ u, p0 t5 m
<script language="javascript"> 8 L: {9 o8 ^" \* ^$ d4 u
function IsDigit(cCheck) , I* g. P9 ]4 y3 A$ b( r( |6 i K7 ?
{ & V+ {: Z2 Q) V! n
return (('0'<=cCheck) && (cCheck<='9')); % B& A3 d* \: p, C5 A
} 6 t& ^/ r; C1 a6 E/ m9 F3 X z" `0 W
! ~6 p8 t) i, d V+ Z% x6 O/ T- kfunction IsAlpha(cCheck)
2 T; s# Y1 j w { . |" `* I# y! }5 X1 ] B8 K
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) / L/ y4 p+ r8 l. Y4 B* j1 O0 {8 ^
}
1 @" ~, h/ W% S & j; B$ D- o$ Z) e( M
function IsaNull(cCheck)
) K( M( Q8 @: J2 C" \ { + ^# C) v; x* _
return(cCheck != " ")
9 f9 y. X# ~ ]6 b/ M% ^1 z } ; X4 u! V: F1 W. q) g) J( Q
% e+ n' z& Q# o& b8 `function checkform() P h+ V! n) P# L/ W& }7 X# a
{
. @* ^; _/ n* Q1 B; w/ ~9 w! R* ~ id = document.sform1.id.value; x2 E0 p" g7 y2 s
if (id == "") ( F6 E7 O5 A; I
{ / P D% t) p7 B7 G0 N- Q
alert("请输入注册名");
f, K; F$ K* [; N4 k. D( i document.sform1.id.focus(); . X% M x5 y! K4 `( h5 N `+ g. b( W
return false; 8 Q+ ^% }/ S7 e( y' D1 i# H
}
2 P" q3 u9 e' r0 m3 `
# _+ S% D3 S' E a4 r for (nIndex=0; nIndex<id.length; nIndex++) ! D5 j/ H# H( I2 i5 F6 w7 ]
{
, r% A! j0 |) c6 U) d( z cCheck = id.charAt(nIndex);
) C, r& r1 C4 K if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 9 |, d. g, [5 G
{
3 ~9 J% x# o1 V+ t _# U' q alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); , G. v! b6 J& Z% n/ v- g: [* G
document.sform1.id.focus();
" Z& ]+ V" r8 V9 e% `, i return false; " V* M0 K: ?) R. r8 d7 Z2 Z
} 4 @3 N7 r+ D: \
} ) Q2 p# {6 ]$ k3 H7 h k6 i
chineseid = document.sform1.chineseid.value;
# g& L# `8 M+ D+ N4 N* Y! r if (chineseid == "")
9 w* T" n6 y( n {
% t1 `. r' h! ~. l( x alert("请输入中文昵称"); ( X2 S: @, Q. @8 h, H$ e, D C
document.sform1.chineseid.focus(); P; s( C2 R/ Z
return false;
; f% {& z* F/ j6 s9 w& h" s% Q } . Y+ G) S: ]) L; V; E
password = document.sform1.password.value;
) I, M* G6 Z" K0 U! T: o1 Y if (password == "") 8 ^$ e; q, v/ [0 W. V7 L& `
{
+ K- k R4 E3 q+ a0 o5 C alert("请输入登陆密码"); 2 z& r/ {" I w G" r: q
document.sform1.password.focus(); * M) C1 q4 R. B# ~4 p5 m
return false;
" h9 V/ v: i7 u% W5 {. U } 1 S/ M5 U. \, J0 X; A
password1 = document.sform1.password1.value;
4 c0 m4 I9 p+ U" g: j% d ^ if (password>password1) / N% Q4 S/ X+ b. T" L+ ~- q0 V( @
{* J) {, J6 W- N) {0 a: [; p9 G
alert("重复密码与登陆密码不相同");
) Q) T% R1 i8 C/ A' L document.sform1.password.focus(); 7 {0 M+ k4 X. o
document.sform1.password1.focus(); 4 a% F8 E& u: G6 o
return false;
5 T. y5 h0 ?# P8 S& n7 I } 4 H8 _# k+ I+ s7 t8 K
if (password<password1)
* {# s- |% N* M3 N {# i8 X3 ^3 k9 N- I7 _4 l
alert("重复密码与登陆密码不相同"); " N# I6 m8 b5 C% ~" @
document.sform1.password.focus(); % R, j. l' C/ d( W. o' v
document.sform1.password1.focus(); " I0 `5 m( d1 \/ d" i) p6 T. Q
return false;
8 m% ]- }" K+ r; Z$ X: L9 \4 A }
f! H1 m3 F' l if (document.sform1.email.value == "") 7 l4 ]5 ~5 x. i- `/ ~$ k- [ k
{ ; X$ n6 `0 D7 W- S- |. l! S
alert("请输入您的E-MAIL地址"); * R' k8 D7 w4 x0 a ]" C6 x
document.sform1.email.focus();
8 T' x, R3 D7 r( z1 H( U return false; ( h+ M5 B& }0 X
} 5 J% t$ k) ^7 H0 _
$ E0 g0 L2 V7 q( r5 v email=document.sform1.email.value;
1 \" U1 p: Q% n emailerr=0
% k$ B3 M5 W& n& B4 M# e for (i=0; i<email.length; i++) d# ]0 h; d* f0 E
{
* l9 [0 J. f3 i( W" k; P if ((email.charAt(i) == "@") & (email.length > 5))
2 @& p! l% F$ l+ ~2 F( e6 z* ]3 n2 M {
: [9 F. |" [* k: {" R- X& A1 n s3 J5 T emailerr=emailerr+1
5 S6 {' k# n5 n( a' g; V2 j }
; j9 `0 t* S8 h+ O6 J4 x' R* h } % {: ~, B: b0 t! F8 h
if (emailerr != 1)
1 Y+ v1 Z9 v8 ^! ~ { 5 P* j' r+ P7 h
alert("请输入正确的E-MAIL地址"); ' T) d# G0 w- u3 n4 d. q0 P
document.sform1.email.focus(); - \- x w6 N* o' l! M
return false;
' L2 s# R4 c* u/ C }
; g Q# t8 F$ s& [& u
& v6 p" E, V( Z: C if (document.sform1.checkask.value=="") 1 \" d% T; D2 |7 K/ v z
{ : E; C" X$ e# Z3 {
alert("密码提示问题不能为空");
9 E6 Y/ | b, \ R& ~; p8 f document.sform1.checkask.focus(); 0 ^5 ?, D) i5 v0 g9 v/ u4 a8 c
return false; 4 l6 b1 F$ \) h
}
* ~1 g0 |3 h! ?3 q4 S if (document.sform1.checkans.value=="") ' b! j- }" ]: P; `
{
& N4 z6 M+ ]( v4 V$ m; R3 z" L0 Y alert("您的密码提示问题答案不能为空"); & ~; u) C" F2 U t7 w+ q2 g$ L
document.sform1.checkans.focus(); : h+ ?4 k$ J! z, s9 p; E) T; Q
return false;
" a6 A* V& i2 e) D }5 ]' l' @' M) k+ z4 K
return true;
3 L+ M' F+ K- D' V' b2 b: C% D1 { - o# O$ A8 N$ K( p3 C9 s: \
}
7 A3 C, L6 M" y7 X. t: T* o</script> |
|