返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" ^, P$ K# e  W. z" Hvar marqueewidth=300
+ g5 f/ D+ A' o5 X+ l( Z//高度* ?" o0 A3 u  ^$ l1 v
var marqueeheight=25
# E0 x# w7 r* _6 z//速度(1-10)
3 j/ j7 M) X' e6 |# b8 avar marqueespeed=39 v0 I3 }9 G+ W& e' n
//背景颜色
' e  b' M1 e: g0 h# f1 @var marqueebgcolor="#FFFFFF"
& {* L6 Y3 |8 l4 |7 e) U* {! i3 G//是否能暂停 (0=no. 1=yes)?
% b5 c1 c1 F, M9 zvar pauseit=1
" ?9 z3 P0 E5 G! L* e2 a$ ?7 x6 {$ p( d) _- h$ Z, [, y
//修改显示内容! T2 q8 u. C# `  `% c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 `+ @5 d. F' Z0 v, |

" O" x; Y5 t) c" b. @+ I
/ i. l) B9 X! X  G9 k' \- t////下面不需改变////////////. X8 M. j! g7 k8 e# L3 w
* A* T, ]3 {8 Z* S5 m! m" c
var copyspeed=marqueespeed
5 \1 n- z) L9 m9 d- T! y8 qvar pausespeed=(pauseit==0)? copyspeed: 0; U0 J( s6 X% T* s: |2 c
var iedom=document.all||document.getElementById& d6 M, `: `0 E% W8 ~
if (iedom)+ ]: r! a: z3 `/ N, n6 x" _1 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 e2 Z) b" U& [$ t' Pvar actualwidth=''
0 T1 q3 _. V- q) V7 P* Xvar cross_marquee, ns_marquee; y$ K7 u* X( x' j2 P# A0 N- h! F
+ E5 u: D/ D. Y
function populate(){3 C6 J1 M8 v! E4 V" E; B
if (iedom){* v+ r& x4 M) o( m% t) u6 h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 [3 \$ V: i) v
cross_marquee.style.left=marqueewidth+8% P- _' s) P- z7 v8 ^& D, l
cross_marquee.innerHTML=marqueecontent' }  X0 w1 d$ M9 b; m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# x: t" ^) _0 r8 C& |5 l/ Q$ K
}
4 X8 q( c  ^7 W, J$ x  C4 w. felse if (document.layers){
# i8 {1 D2 t* L: Sns_marquee=document.ns_marquee.document.ns_marquee2
% N& C, ]+ E- p7 \$ F1 @) Kns_marquee.left=marqueewidth+8
, r  g8 y. W, u& lns_marquee.document.write(marqueecontent)
7 f: Y) l5 o9 q+ X7 x: tns_marquee.document.close()
/ g3 c) N# S5 E$ factualwidth=ns_marquee.document.width
: ^0 P3 |* i. ^- [7 ~}
2 L$ m8 _$ X3 s' W0 X' g9 `lefttime=setInterval("scrollmarquee()",20)
( f! r2 V# ~; O" A' P}
4 i0 N) T) Q% D6 \* M% b7 kwindow.onload=populate0 j  v# l5 G$ y4 d/ G3 ~! a8 o

! W: T6 |7 {- F5 wfunction scrollmarquee(){  x2 o- o9 s. c
if (iedom){
( E- K7 o0 S( z! \7 @! V; g( c7 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  p# ^) T' f) r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" |' z9 }% ~& G0 o* c3 ^else3 Q, O& d0 P* j0 z2 M
cross_marquee.style.left=marqueewidth+8! K# {5 R, [6 k" ^2 k4 S/ j

- `5 L3 ?% n  X( m4 r}
: G3 Z5 s: T6 d2 Delse if (document.layers){
, G* s- ?! [+ M2 |9 y6 Tif (ns_marquee.left>(actualwidth*(-1)+8))
' Z/ g& g0 `9 c8 C, A2 m4 bns_marquee.left-=copyspeed6 t1 b# A* m6 h% k' E, U7 o$ h& _
else  d' u  K( }0 e3 ?% x
ns_marquee.left=marqueewidth+8
9 b. Q4 u4 W' t$ @# v5 s) z1 _) }}
. N# H; \# t5 u1 b& H0 E, L}
2 j6 k, u& K$ p* F
& c, s1 f4 E5 L' p" z* Qif (iedom||document.layers){
% |9 H  L3 U& W& ?with (document){
+ X/ G) G, F0 o( A7 Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 T" @" d. V7 }9 B" T3 ^
if (iedom){$ e: M/ [& P6 n9 r* n2 _1 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 k2 C) M+ E% d! C! S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' V- _7 n, k7 s$ N7 }& c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" J/ M2 h: k) |* N+ _/ s' R1 {3 V) N, @
write('</div>')4 p/ _+ h, E8 @( w
}
: \7 L8 y. ~# u; H) k+ Y  Celse if (document.layers){- k, Z+ o# V# I" D& W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* n6 c; g# [9 D6 v7 J  S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 I3 X; C+ J$ G6 O  y3 Q1 G& Z7 B& V
write('</ilayer>')- k+ K  T% J7 V$ x9 F0 s9 L: `
}
1 I/ X% o5 o) rdocument.write('</td></table>')
+ A$ c, }0 Q5 a}
  y: K" D0 M3 f$ ]; o3 A! S4 T}0 V5 L) x& A2 m
</script>

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