|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:/ ^7 m1 k" G( C
<script language="javascript">
, v7 \) g8 a# P; z# W7 ufunction IsDigit(cCheck) 3 d" |/ h& i+ f" v4 d( L
{
* E$ l8 z8 ]2 d5 ?! z* Q return (('0'<=cCheck) && (cCheck<='9'));
. A: a( n/ p- ^3 x" @; b9 `) @ }
/ [2 p% S5 m. E9 }" ]2 s1 y/ o
- E* |4 E1 k; g$ J+ qfunction IsAlpha(cCheck) 0 W5 g3 ]% U) @5 ? p' O# `
{
+ T6 c# ~0 ]7 t+ ~# ] return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
, \( n' i$ W' U; `: V8 t. B/ `$ i3 c } ( B) Z9 r' S, V5 i+ K6 w
' N+ J# p1 g: r( Z3 P" nfunction IsaNull(cCheck)
$ G2 F! m5 x7 g; M7 r {
. B* r2 |: O7 C6 @ return(cCheck != " ") ; |& Z8 y2 X7 ` v# @
}
7 v0 |: [! D) G$ L6 B
; K" z0 a3 e/ b. q y) Nfunction checkform() ! V! X& L: j h; m5 ~& j
{
! L: l* s6 h" r, N$ I id = document.sform1.id.value;
, e$ q6 C; j. A/ L. W( {# i if (id == "") ) y8 }, m! _ X- T/ U: g8 D+ a3 C
{
. @* ~9 K7 w7 A8 z alert("请输入注册名");
. L& @" Z$ @+ L9 K" o6 v document.sform1.id.focus(); % T Q/ `+ M8 r5 M( @0 _0 i
return false; * W* m! j/ r/ R) f! b" A
}
7 t9 C+ g% h$ t9 r' ~
# M3 E7 |, R! A! V H/ p3 h( }5 { k for (nIndex=0; nIndex<id.length; nIndex++) 9 T$ }2 d0 s4 J' H/ I7 f. x3 M
{
- Y, O+ t3 K7 i* }+ `% y cCheck = id.charAt(nIndex); ; \- N8 j% h& o5 F2 B5 X# f
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
7 t2 d; U6 H2 F {
$ l8 x5 \1 ~& N, L alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
% J# R7 ^$ g' ]2 D document.sform1.id.focus();
; e+ V6 B' e6 v1 ^7 { ~: d" g5 \ return false;
6 {; a& K, N1 `5 E% } e } k7 r' T1 B; z& L' @5 X: r
}
$ B4 Z1 o* D+ t- w# _9 A5 l chineseid = document.sform1.chineseid.value;
1 O E7 K$ b: r3 ]9 q( X if (chineseid == "")
+ G) K" U, e# v {
# [4 `1 L: L5 A, A! j alert("请输入中文昵称");
7 j$ b! A/ s# o. g) h; } document.sform1.chineseid.focus(); [+ g5 Y3 a) j" e. {' ~$ G
return false; * h+ a# I. R* O1 L' |' n# i$ j
} a0 S: _; n) j w/ _! {0 {
password = document.sform1.password.value; ' ^8 w8 v; M- G
if (password == "")
! [. W! B7 \: T4 z {
9 x0 `! }! J9 X4 K- U5 m alert("请输入登陆密码");
/ D% K P. |) q8 H, w: Q0 {# l document.sform1.password.focus();
! W/ S/ n; x3 u+ i* t% K( m return false;
, z3 o& V5 R6 u# I }
2 c5 ?" c) y! C- H4 v password1 = document.sform1.password1.value; , x3 B, g" L r7 Y* S
if (password>password1) " M1 D# r7 G2 |4 x0 a" {4 O
{2 S" h! T; d' ?$ v( d6 F
alert("重复密码与登陆密码不相同");
- E5 v9 I" S k9 g3 |; J$ W document.sform1.password.focus();
/ M- a4 s( |+ g9 U& c1 _7 u! t+ ` document.sform1.password1.focus(); 3 N8 W3 k* j4 B: d' g" a
return false;
' D% y: u8 u B0 a }
- L' ]3 {( Q3 Vif (password<password1)
+ I) @) M9 \' g, }% d! G0 S {8 z% ?8 ^4 y0 N
alert("重复密码与登陆密码不相同"); / q. Y0 I5 P* I: |& Y5 K" D1 D4 I/ V
document.sform1.password.focus();
' f+ P7 l; _. o6 M& B7 h* o document.sform1.password1.focus(); - w: x: L+ s; Y) p- x
return false;
% J, }1 Z) I# i3 P: r }
9 ^$ j; ^( u( m: T6 N, v E1 P if (document.sform1.email.value == "")
0 D/ }& ?$ ^# d& p6 o0 w { 5 G* u" F' [3 S2 L
alert("请输入您的E-MAIL地址");
% I0 v8 n: s" Y% ^4 N. f4 T document.sform1.email.focus(); , Q, ~. C% P. }1 M2 j8 u1 V
return false; 2 h. p8 T5 }" m0 x% H
}
: g4 k! L1 k: A' ~ E' A
( H0 ]* w. Z, A G- M7 Y email=document.sform1.email.value;
% r& p3 N( s* h2 U$ o% i emailerr=0
* A9 W. \$ P% i/ o/ k9 ] for (i=0; i<email.length; i++) & g* }9 n6 o+ }4 ~) F8 `3 X
{
" r5 R) u& B2 t! O2 K if ((email.charAt(i) == "@") & (email.length > 5)) $ z/ |% H e- x) I0 g5 b
{ 4 X. ~+ r8 ?/ n9 f' B& A
emailerr=emailerr+1 5 I) n& N) a" v7 x* `% x) r& w# ?: g
}
! B/ C1 ?/ w7 X6 i; O+ s1 G }
3 a. V1 @/ T( q! a' ~7 ]3 P% { if (emailerr != 1) : o6 H2 `6 R0 V+ L5 J& p
{ ) O9 `2 E2 S& ]' j8 M
alert("请输入正确的E-MAIL地址"); / n3 \9 L* B* r& K3 \0 b) { s& Y
document.sform1.email.focus();
7 G) p* U" v" |( J# J return false; ) r$ B/ E% C* }8 i0 a5 |$ F
} 5 h$ t) {7 ?. ~
2 f7 s. Y5 @' y" z if (document.sform1.checkask.value=="") ( |1 B [% O5 f
{ % Y( H6 G8 s0 ?. ]% j' z5 p% P6 v
alert("密码提示问题不能为空");
" N$ G! f5 O) X3 ] document.sform1.checkask.focus();
) X. V) x. l- V7 z return false; 8 R' G- ^) H5 j! h) | s- Y
}
4 `, t+ v k# X+ G if (document.sform1.checkans.value=="")
' Q$ N6 _+ [; V' B6 q { ' F0 ]' `3 e. o9 H: a$ ?
alert("您的密码提示问题答案不能为空");
8 L& Y, ^0 W. b$ y document.sform1.checkans.focus();
' R! X5 A6 {% D( M return false;
7 N* d# X {7 G; z# E; k }
: v% ~# {+ j: E/ I7 u return true;
; d' D) R3 s" W" k
' Z4 z2 l; M: g! n) o/ r3 X Q- C}
9 B5 w3 k, p. Y7 I5 n8 F</script> |
|