|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14313
- 金币
- 2442
- 威望
- 1647
- 贡献
- 1390
|
这个脚本对你可能有帮助: u! N5 @! ^1 E& S
<script language="javascript">
4 H# R3 e4 ~5 ufunction IsDigit(cCheck)
3 S- b. |# e1 e' p! j/ T+ @ {
1 E8 x; N7 K& Y8 o; w w4 o return (('0'<=cCheck) && (cCheck<='9'));
1 R# m8 i( h$ [8 T, u9 J; p } ; c6 a. U8 L) g2 R1 v! b2 ^0 |
! ~" [1 v9 {! m' X, s, Q- `
function IsAlpha(cCheck) 7 f" O4 B) f5 A
{
; v: [2 P& H+ ]2 t/ U: W7 _6 { return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 J* M/ N0 V2 P$ w& E6 V } & R( \. [( l' a! V8 A: z( c2 d6 A: [
+ z1 o$ E# |+ E5 |6 H; Ffunction IsaNull(cCheck) - @. K( G0 d) @; B$ u6 c5 q$ n9 z
{
6 ]2 n2 y" I% M! {# K' f return(cCheck != " ")
, u- R) {7 a9 t9 D } & ?0 e# `5 t0 B: u9 ~" ^% v! ~
' v" a( L4 y% A* |/ E* M7 N& qfunction checkform()
* y+ D) Y# n1 a- V# {4 I: d6 Y{ ; J+ R6 Q$ I/ M2 K+ X; [
id = document.sform1.id.value; 4 b2 ~* ^; Y! o! s$ W4 W
if (id == "")
0 b# V- H9 g: l( S- R9 t! a1 j: \; K {
- [2 o7 T6 B0 G X& U alert("请输入注册名");
8 A6 U/ p: O5 s" j) j3 r document.sform1.id.focus();
) y4 p/ G+ M v/ s0 G2 v1 x& Y return false; : R1 Q) j2 j+ F1 |3 F+ D( A
} 9 R6 `5 U: c$ h" f
2 L5 v+ {" x1 \2 |8 d
for (nIndex=0; nIndex<id.length; nIndex++) . f- i* M0 Q* W' y
{
" ?$ U2 U$ ]* c/ K8 e7 p cCheck = id.charAt(nIndex); - Y4 e3 }) i7 M3 g
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
' e8 K8 |* V- A6 x3 H { 4 l8 r& ]) @2 J! e
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
$ b) k% W0 q( ~$ o, F) B1 @( v/ H document.sform1.id.focus();
# V% D( x' H0 y return false;
' G6 L6 S( K J& B8 E( h }
V- @+ N- ~, f5 g+ G } 7 d5 q0 o3 j: c, \; [
chineseid = document.sform1.chineseid.value; & U/ B6 j# _4 U3 V0 Q
if (chineseid == "") ; L3 y0 O, m4 y1 f6 A) Q
{
* F1 N8 D" B1 D$ h# @$ `: k$ h1 n alert("请输入中文昵称");
8 ]1 v4 y# B( ^) A document.sform1.chineseid.focus(); + ]0 W1 Z" a( w8 J2 n* N
return false; , p {5 x: O! u2 {6 i2 \
} ( G7 d8 U7 p, z0 S
password = document.sform1.password.value;
5 `( r/ ^5 K/ \: ]# I0 C7 h if (password == "") ! V- \; K* p+ l2 [; A
{
G: V; A7 y* P alert("请输入登陆密码");
9 b" G, ^1 A2 G; Y document.sform1.password.focus();
. l- w( q* d! e return false; / Y' ` q2 B) ~" M" N
}
+ Z) y6 P% p$ C# f6 ~- L' }. E password1 = document.sform1.password1.value;
/ ^$ ?& O- M8 E if (password>password1) & A, q @" p: p/ a& z
{
* ^5 J9 C5 {" Z alert("重复密码与登陆密码不相同"); + N4 t( F% d3 Y- {4 e
document.sform1.password.focus(); . x4 w7 I- P* Y
document.sform1.password1.focus(); n1 N \4 P+ L/ u+ `6 _
return false;
. d. M/ q0 C/ x7 O* ]5 {5 ? }
8 ^; s/ k( x5 H+ c( z6 xif (password<password1) : {- @! {, r5 Y2 Y Z5 C
{
. ^0 R2 q' O& V' t3 F1 H! L alert("重复密码与登陆密码不相同"); 9 ^8 B3 L. S7 k. h3 i' N# u
document.sform1.password.focus();
# f9 ?! y8 D* I1 t, q) g4 G document.sform1.password1.focus(); 7 c* l0 I% n! i& d( u0 K
return false;$ J9 t5 L8 V' n. S& A* S* V" L
}
* p( @, k3 A5 t5 F if (document.sform1.email.value == "") : z+ X1 u9 a- }! q8 ^2 d
{
6 p( m$ g4 D/ \# f; F% r4 t) T alert("请输入您的E-MAIL地址"); , D+ f9 u# d* j! d
document.sform1.email.focus();
, E6 @1 \, L! y return false;
8 g7 s( M+ q+ b [- H) h3 |5 s }
/ D! y% j v+ l! `* i # k" D" r' s( f
email=document.sform1.email.value; 1 r- C# h; e3 A' j6 y
emailerr=0
) y2 g/ l0 S* E% t for (i=0; i<email.length; i++)
( O! J. |5 s$ ]: L8 f+ R& j! { {
$ W7 m: z: b7 X4 k/ d0 f if ((email.charAt(i) == "@") & (email.length > 5))
3 l- k; a9 ^7 {& n% o {
% ?/ G: A. h. ?3 M emailerr=emailerr+1 5 k6 q9 W- X2 W; ?( x, ~- O4 O
} * V0 @( q) V) F! X. \+ _
} 0 C" }* v2 `7 W, ?
if (emailerr != 1) / t* F2 y$ B8 D8 u. T; s
{
; b/ J* {( `, V( k0 q" ^0 P+ } alert("请输入正确的E-MAIL地址");
3 l& m* G" `. [* ?; h document.sform1.email.focus(); % P3 @+ h( ^: v* P
return false;
) t# g1 A% q. r- _' m } / V$ Z/ G d8 ^8 F4 M
, N: A" o( R) q5 F9 k* j if (document.sform1.checkask.value=="")
( q$ h6 |/ @8 z {
! M2 I- z2 g7 T$ C4 F |+ j( p alert("密码提示问题不能为空");
! ]$ `9 k6 E3 T document.sform1.checkask.focus(); 3 T% H& l' Z: D$ U( T; ?
return false;
3 o/ W9 N9 K, { }
( r& a2 j, ~$ {7 [% X+ y1 M if (document.sform1.checkans.value=="") / v F) |& Z1 k( c
{
' @: L" q' s4 _& l; t alert("您的密码提示问题答案不能为空");
Z7 A* o2 E7 T' v3 k document.sform1.checkans.focus(); . `! G' Q# ]' }, t
return false; 0 _3 Z9 B6 Z" ]) Z- m, ~
}4 d* H5 g5 d0 r- s
return true; ; y! Z& n/ L+ ?" u# y7 p( E F" D- b
3 I' {" t9 T& S; [0 ]
} 6 H0 O9 ~1 m( t% @) S, _$ Q1 V
</script> |
|