返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 X& Y) r" R& k2 b' v2 D/ ^var marqueewidth=300
1 v+ j1 c9 D" Y2 i8 n% F//高度
# G; B) L. m3 lvar marqueeheight=25; G$ g8 h6 `: V* j" j1 U
//速度(1-10)! d+ N0 S, h; _. r, }% g6 |
var marqueespeed=3
) g$ l+ t) L. W# E+ G) F//背景颜色+ C" z. s/ n; U0 [# D5 Q6 {
var marqueebgcolor="#FFFFFF", a1 k! T' N9 ~
//是否能暂停 (0=no. 1=yes)?
! E% ^7 p" t8 [var pauseit=1
0 M; l2 }0 @( E- x( W5 ~* m. b$ G5 d+ W1 X
//修改显示内容
8 D& W% V/ N+ @2 [7 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- E! i& X, r0 H" s8 o  F" U( ~" L

# l5 }9 P  _  Q1 K3 S# _- l, H0 i# q: {' |* y6 U/ P+ A4 b6 _
////下面不需改变////////////
% D7 }+ m- ~% h" T( H8 D' k
' _) M8 s" J* i: x3 Ovar copyspeed=marqueespeed
; z9 ~- d2 C' jvar pausespeed=(pauseit==0)? copyspeed: 0
4 x4 E7 t5 o% k( z( u; q7 m0 cvar iedom=document.all||document.getElementById
7 S/ S' E, [$ Y3 ?if (iedom)7 G; q7 V# s4 ^, ?$ q0 W- t. e+ M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 ?- {( W3 I  @) Y) A
var actualwidth=''% D8 s" J) _3 Z$ f
var cross_marquee, ns_marquee* v4 y8 C6 d4 k

" C) p/ s, V/ b. bfunction populate(){
, [6 A! L( H5 H1 W1 R. [1 x6 Q) {if (iedom){
' m! s6 T, a( P7 w7 J3 C$ rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 W4 v1 ^$ c7 C; Kcross_marquee.style.left=marqueewidth+8
9 a& N8 @3 X; [0 P0 xcross_marquee.innerHTML=marqueecontent
& Y& c7 C% N2 h( e5 Q! _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 w7 t5 U- y7 s; n
}5 u: m# Q$ _" D( t6 j
else if (document.layers){
+ w5 D3 b( w$ @) e- M. s) jns_marquee=document.ns_marquee.document.ns_marquee24 C5 @  h0 X# d4 @. e" r
ns_marquee.left=marqueewidth+8
0 w8 t' x: d- W0 fns_marquee.document.write(marqueecontent)! D$ x7 s8 M9 O" ?
ns_marquee.document.close()* \% [7 m; d; a
actualwidth=ns_marquee.document.width
: h( E9 @; `7 l8 t0 h. t}* }! b& t$ m, v& ^- v: @
lefttime=setInterval("scrollmarquee()",20)* u4 l: t. R- W3 B
}! h; P) [4 w7 J1 A" S1 Y0 P
window.onload=populate
+ @% U( A( ]  f2 V4 {3 L3 z0 M
0 x0 h8 B9 W1 J4 s6 M5 D8 [, F- P; ^function scrollmarquee(){
" }# m8 f) Y$ U+ E( E7 sif (iedom){
; I" B$ U0 {. t, S+ A1 M. sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; R3 i* D! H7 P9 Q8 ~$ B; Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- A6 c( r- Z5 m# @& J' Z5 C
else; @: i( U- p% J6 y) v
cross_marquee.style.left=marqueewidth+8
9 W; u/ v& }: ~: ~5 e! O0 b. U9 ~1 G% H* v
}
- B1 k3 f% B& Velse if (document.layers){9 ], L1 ~8 y' N5 }0 z7 I
if (ns_marquee.left>(actualwidth*(-1)+8))% D: P) c% D3 g/ l& w
ns_marquee.left-=copyspeed9 T; V# R6 w5 i- g, n
else
7 N; f) t# T+ C* D  Kns_marquee.left=marqueewidth+8
( s: B/ T- X; m6 Q/ h7 V  F# F}
9 m8 `5 \2 l- r( _* z* T# q}
8 L9 _6 G; X2 \; d/ q" ^+ a/ S: B" s: q5 {7 H
if (iedom||document.layers){! A! [0 V* |' s4 f) t5 t
with (document){3 c2 F" h% }1 ]  P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" K* {! l2 n/ U- M# uif (iedom){
( H! ~3 s6 L4 W; \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): l. A2 Z/ C1 x0 k5 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# t. p$ E. m! _" B/ @  h2 I) d) |; P) x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 {" Q  X9 t% }4 O% ywrite('</div>')
9 M0 z, j! g9 S}" B7 \( G( z8 x  ~6 r/ G3 K8 `) V& F
else if (document.layers){6 X- C+ [- I& h, `7 _6 ^9 i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 i% n/ i' K3 ^0 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 L/ d3 h% p; d: M  j4 G
write('</ilayer>'); F; d  c/ e6 q% e/ O% ^
}5 p6 R3 l/ o- F8 v5 a
document.write('</td></table>')
# I6 E4 m4 A# I- b- F) G}
' Z" ^% S( o, K3 K- I" B}9 [/ c' x6 O3 p+ S( l+ H
</script>

返回列表
【捌玖网络】已经运行: