|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14353
- 金币
- 2462
- 威望
- 1647
- 贡献
- 1410
|
这个脚本对你可能有帮助:
) B+ c' W9 W4 G' }% a<script language="javascript"> & m& S5 G- Z/ ?5 T
function IsDigit(cCheck)
, G5 M' j# Y- F1 E8 e {
( H% B+ Q+ h: y return (('0'<=cCheck) && (cCheck<='9')); 7 h4 O+ D$ M: p# G0 L) {7 O) ]5 D
} ) G" ^3 F9 }1 |! u* I# h8 ]
0 W6 P# i. ?- V8 P; M( g6 @
function IsAlpha(cCheck)
+ q, @; A9 n* a* |% h {
7 L; ^7 r" J6 ~" A. M0 u4 h3 d return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
/ M9 Y: F6 d2 R } 1 E! e; r; t; k' {
/ b$ D4 C2 l$ h7 wfunction IsaNull(cCheck) : f7 q' D* P: G' @2 g$ O+ C( H
{
7 K( S3 H5 |- Y- | return(cCheck != " ") * l x6 O% F$ G$ T: R) N9 H
}
) U3 c, E6 v* w# ]: s
5 @% @1 O& n$ t6 [, lfunction checkform() 2 s9 O- d, x; }) j7 s: k6 D
{
( m8 T4 V8 e& h( o7 t' L* l: \ id = document.sform1.id.value; ' V; x( G: L ~; y
if (id == "") 4 f4 s/ G0 R- S/ X
{ 2 e! s- U7 p8 [3 d9 n% o* I
alert("请输入注册名");
8 ^. e# h& t9 ^* {" A" G7 G2 t2 f document.sform1.id.focus(); 5 L7 Y, a! r6 `3 J- b+ S n7 g
return false; & E, k) H6 i3 k( c8 ]+ y* w7 _
}
6 ?& N# o" W: p7 a8 F6 f
1 h2 g2 K5 B* r C/ X9 w k for (nIndex=0; nIndex<id.length; nIndex++) 6 \, Z, U/ [' j* H
{
$ d3 S" O/ q0 d- ]( | cCheck = id.charAt(nIndex); % q- F2 @3 O0 D/ F( h3 R
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 0 A( ~/ H" Y+ O1 g$ @5 b
{
/ n& W; F. D4 w( ?9 P0 Z$ ~ alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ! e+ ]8 a1 Z5 f! C F5 @( X
document.sform1.id.focus();
7 W; u5 V n: T! m! t E return false; * K$ ]: A4 N% X* U
} ; p( R. W' ^; V; q" w
} . }. |8 z& I9 R+ q
chineseid = document.sform1.chineseid.value;
- U8 q2 G8 F) b, Q- V if (chineseid == "")
1 Q" j: D' }8 a# Y% p# h; p { 5 e8 S, M8 F5 A1 h# N6 V% M! o+ K
alert("请输入中文昵称");
, r8 n2 N+ r# a; k6 \ J document.sform1.chineseid.focus(); ; D- p4 y: V/ p |$ g# d1 F$ l
return false; / j! |9 A/ B, t1 v! F0 N2 O
}
; S c% ^4 v5 V8 ^% o. e: o5 j password = document.sform1.password.value;
& G5 }- M2 t- h- A$ k, P; b if (password == "") , ?" I' O6 m D# l- u' e
{ * S+ \) h4 O5 I
alert("请输入登陆密码"); 5 }+ S, G+ Z+ A& _" g# J
document.sform1.password.focus(); / V) u7 k2 i* x5 c% p
return false; + p+ N3 f$ b. k' m# [, j
}
4 F+ F$ q. b+ b" L x& _3 |* L5 s: A password1 = document.sform1.password1.value;
7 K, x: }4 E* ~" B# x) K if (password>password1) " T5 ^5 e6 D+ ~% j" o! p# m5 d& z
{
2 m! Q$ e, i2 u! |4 n$ g alert("重复密码与登陆密码不相同"); + R+ H8 P, [3 @. c- l- P
document.sform1.password.focus();
* e1 a& E4 v1 E2 e. T) q* r7 V document.sform1.password1.focus(); ' N4 i( {7 X4 V& y, K$ o& l x
return false;
3 O ^$ k& k3 C/ K }
! F* F/ [$ S" V8 M$ Zif (password<password1) ' _" E' I8 j/ x) ^& @8 f. G- ^
{
+ u R. E9 V$ q9 ?6 ?8 c& G alert("重复密码与登陆密码不相同");
: y) v. m, B5 z8 l- w document.sform1.password.focus();
% m0 {2 F) s/ R$ {0 F9 h document.sform1.password1.focus(); : y" k+ Z. ^0 i
return false;
7 l1 g1 Z6 C" G& B; ^ } & p/ I2 ?' n/ l0 w2 d# A
if (document.sform1.email.value == "")
& t2 g3 M. a8 B" i4 k) K {
9 r' v8 ?5 ^0 v3 {7 l/ m alert("请输入您的E-MAIL地址");
4 D8 h) W( S/ t, c! r document.sform1.email.focus();
- y8 R! r; z5 X2 B# ]6 P return false; 5 o7 D. t4 z! \0 `, Y) {
} / g9 b; a- F: N# d
8 d, k* K! n+ j6 \6 L
email=document.sform1.email.value;
" k N& e9 @$ u" C$ w* T% d7 q0 v) u emailerr=0
5 X! C' y6 z1 b4 h5 }1 r5 M, X for (i=0; i<email.length; i++) ; H( d6 V( }* y' f e- c- g
{
) l2 C" u0 V/ P. c! N9 Z. `: d x J if ((email.charAt(i) == "@") & (email.length > 5))
! ?6 E% F2 c+ D2 }1 t3 E {
) o8 x: `- N; i$ `3 y6 B8 t! o emailerr=emailerr+1
3 a. L4 U( @/ v2 {+ R# d3 H } 1 N3 ?4 h& `+ h
} $ j8 ^1 Y4 e q/ c) W; D
if (emailerr != 1) / W6 b6 |2 `0 P1 ?1 a9 I
{ 1 d& u, v% J" ?( n! ^2 R; f
alert("请输入正确的E-MAIL地址");
7 ~, m9 E. R5 b% y" X document.sform1.email.focus(); ' C' D4 }/ M0 M7 w
return false;
3 v6 {( Q8 u5 b- V7 s }
. J' B* [4 ]# j# t
- V/ \/ Q* q# L( g( ^- b if (document.sform1.checkask.value=="")
5 ^6 p+ j. X* S! Q {
5 b# H! h B2 j1 J6 F# j alert("密码提示问题不能为空");
$ u7 T2 ~5 R& |, N8 ?3 L" | document.sform1.checkask.focus();
1 d0 d& Q% T8 l& D' H return false;
3 V$ x6 m9 W! l }
9 \* o% V! C- s% v9 K( x; H if (document.sform1.checkans.value=="") ) A# N8 ^4 c- O% b
{ 8 L- k2 J( G9 V/ i
alert("您的密码提示问题答案不能为空");
1 J: o! D# w3 ~ document.sform1.checkans.focus(); + h2 V$ H4 U/ Q: A# N$ \2 [7 l
return false; $ g* O- R9 H, @3 }
}* H' T N$ F1 Y3 _
return true;
5 }2 x A) L/ u5 D! M8 m. `2 W 5 F4 b# e J4 B* A) H, |2 c
} 8 r+ T7 r1 \- X! U6 b; L
</script> |
|