返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" F$ ~5 D- v* x  B9 Uvar marqueewidth=300
; y" K4 G; Q+ G: _. ]; [//高度
  X+ [& {6 V- @) U6 ~var marqueeheight=25
4 T1 o5 B/ S9 I//速度(1-10)
! y& j' g! K; `/ t  `9 vvar marqueespeed=3
( ~0 Q2 j" H6 `6 \6 |$ j+ V- g% D//背景颜色7 h1 c4 N9 J! I& t8 I
var marqueebgcolor="#FFFFFF"
9 P" H. o  I: V, k; j' X//是否能暂停 (0=no. 1=yes)?9 n4 }0 N: [9 x6 r: q5 ]
var pauseit=1- ?0 o2 d+ ~4 r$ i# o

" N+ d2 ^8 p1 n; y! W( o, y% |//修改显示内容  h: W( \$ W$ q; X, M# C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 c& f6 |7 V( Y1 n0 s9 M

8 l* F# r: v7 g2 ]7 i* w0 f1 m4 o& i% G& a( ~
////下面不需改变////////////
. P8 r  o5 Z5 q2 Q) l3 g
$ E9 l' c) L4 Xvar copyspeed=marqueespeed/ Z& o2 d/ u8 S! z, y0 g) [; }; L
var pausespeed=(pauseit==0)? copyspeed: 0: o6 E$ M6 M- p! k# i7 \
var iedom=document.all||document.getElementById
+ v) V9 c  J% x/ W% N$ {  tif (iedom)$ O) t! x7 U; N3 ~' v6 C# l* z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 i+ D- U% W, w+ C) [* Uvar actualwidth=''
% [. E3 [  X  Y: qvar cross_marquee, ns_marquee
# I0 h( y: B3 R0 `  T5 f3 ~; h" F/ L) O" I- N. c
function populate(){. L* M" m' |& a$ P, a/ B  {) [
if (iedom){2 f7 \+ V# B9 H; P5 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 w( L- C  ?" F& _2 I
cross_marquee.style.left=marqueewidth+8: G9 \: f9 a) `' ?- R' S' @
cross_marquee.innerHTML=marqueecontent* ~, x& Z5 U. _) n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% R" O1 A( L# R
}
, r0 q3 Z* ?) velse if (document.layers){( O! f/ s) W: f) L! }* p; {% L# x
ns_marquee=document.ns_marquee.document.ns_marquee2
# Y0 o& G* Y6 d1 h1 F" e) o! e: a. Lns_marquee.left=marqueewidth+8$ ~: P, _" M5 n" c* r) o6 K
ns_marquee.document.write(marqueecontent)
# j$ P$ V$ D- o" x+ kns_marquee.document.close()
1 Y% T$ R. X) j% cactualwidth=ns_marquee.document.width* P: w2 U6 y$ b8 C- q3 R# W
}; N' P( c$ W6 s2 x# K) K
lefttime=setInterval("scrollmarquee()",20)
1 c0 y& _: k5 L/ S: Q8 L0 K" W% C}3 r  |% m1 c, X) i3 O1 K* c  M
window.onload=populate! ^! d' e/ A! Q$ x7 U

% P4 H$ l& U# L, Z+ c  `function scrollmarquee(){" P% d9 q4 u8 _& z& i( }
if (iedom){: y" ]% e. K9 W% E& X4 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); r, ^% p& a; ]1 ?" g( C9 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: S! \7 Q& W3 G( r/ `+ helse
- y' e* `" ^  ~; a9 ocross_marquee.style.left=marqueewidth+8
! R$ I: @3 K' ~5 A9 p. P4 D6 L+ J3 n3 |* O) S( v
}: D$ x. B" o0 d, a3 M$ r+ u( S" v
else if (document.layers){
% s: _/ n8 }; ^if (ns_marquee.left>(actualwidth*(-1)+8))( l# H4 M$ |) `3 `: ]" z: D2 Q; Z4 q
ns_marquee.left-=copyspeed! m- B- h6 A+ o, ?9 }8 [
else$ \7 D% X5 N; ]
ns_marquee.left=marqueewidth+8
, q+ |' I" x0 q9 a) H, I9 c}
& x6 }/ L: o* A}+ L3 L7 U6 v8 R3 M
% x7 i8 s$ A/ X# I( ^) R. r. V3 g
if (iedom||document.layers){* V" [8 n" q3 k. D" n5 Q
with (document){  T! r' Z" V# k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 X# Y) M$ I2 P: c! Q5 Q
if (iedom){' d3 N& h' s. ], Q9 a$ `* r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 p/ m+ }' U$ z. u& E6 z8 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 a( O0 w- y9 y% g0 e3 ~) {8 |- |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 Y; O) X' E: u7 [+ ?write('</div>')5 d5 v0 ^! _4 J5 F, h% t+ e% V
}3 d/ ?' d( Z1 ], q; r1 I
else if (document.layers){7 r7 j0 \& \( n4 M# K) u  y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) V# l0 t& B1 m* ~# U& h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ ^: Q1 v# V2 _3 U  {+ E
write('</ilayer>')6 M2 U+ ?, [+ ^; Z& f( D
}
- Y* w9 @# }+ x7 z5 N3 Adocument.write('</td></table>')
! L! b& Y; n- d, C}
. [# O$ e) P0 z; g2 Y5 ^4 u" |2 E}
) d0 P$ T) k; i( y7 l</script>

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