返回列表 发帖

网页之跑马灯文字特效

//修改宽度- w2 l% A4 B* E# @; U  ^/ ~
var marqueewidth=300
- o9 X* D2 u) E5 w/ O% q$ I//高度" P) K/ D- \, c2 j5 P
var marqueeheight=25( {& }. [+ ^; K' Y4 c  ^/ o
//速度(1-10)
( y7 R/ o9 r& Pvar marqueespeed=3
' A7 m0 f# s! K4 @% H* \% _6 o//背景颜色
7 @8 q# J1 H! Rvar marqueebgcolor="#FFFFFF"' ^1 ]: V; P& H/ Q/ P
//是否能暂停 (0=no. 1=yes)?4 c8 M; m+ ], F& d8 i8 K8 {
var pauseit=15 d- s% L) u5 E4 a6 z& r5 D& g

( O! w* s: q* @# ^0 }//修改显示内容
4 u. D! P9 @% b5 |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 |* N4 L- P( ?1 x0 X6 ^3 Q+ m
4 L6 D# N" r. M; ^; A: t  k  L# ]; r+ H: V% B5 M
////下面不需改变////////////$ @+ H: u1 b7 g" o, l7 g& ^

- k3 k4 _3 o+ J1 _' U. r' [var copyspeed=marqueespeed
3 z1 O7 h) Y+ @- Z/ [' Q3 S4 jvar pausespeed=(pauseit==0)? copyspeed: 0+ M+ f4 R! q* C- k! j6 @
var iedom=document.all||document.getElementById  e8 \% \# }& a4 \/ k
if (iedom)$ Y0 ^" L: X+ e& y5 j, z. g: _1 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% M7 R9 {9 _3 Y4 H
var actualwidth=''0 P! J* h6 A) c$ R" G/ \! C) g+ Y
var cross_marquee, ns_marquee
) P( A9 ~# u7 w8 U# t2 ~
3 L, V" i7 e3 X  |- D. Dfunction populate(){
: W) S0 m& W: U8 ]: j" F! ^if (iedom){: \* h, T3 T3 \5 ?0 O+ [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ P) C# e+ x) ?cross_marquee.style.left=marqueewidth+8
* T4 v) P6 m  N" J+ d! hcross_marquee.innerHTML=marqueecontent
8 [$ B' n, l: c- {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% K5 e6 o* l1 X: I. U0 U
}8 V: {; A; W/ u! p
else if (document.layers){% U2 Y9 Q5 a/ h. r; J; G. Z+ T
ns_marquee=document.ns_marquee.document.ns_marquee2
, H; r. Y- G% Z& k; Fns_marquee.left=marqueewidth+8, y5 d0 }# z% x$ M
ns_marquee.document.write(marqueecontent)
4 @) R- h6 W& f3 kns_marquee.document.close()
" _' x3 D  H4 \0 Bactualwidth=ns_marquee.document.width1 p, t+ s9 V- g# U0 u3 x
}
' W3 h. J. N, B) J1 [lefttime=setInterval("scrollmarquee()",20)3 K- I2 c( d7 ^2 ^1 @$ l- c
}4 d7 s+ s0 k/ X+ W: N+ T
window.onload=populate7 ?" Y6 f! [0 j! E  j9 a
6 Q" O9 A- ?8 A( p. Z
function scrollmarquee(){
* t8 E) C4 X% i* b( Nif (iedom){
) D4 B* f5 q' A" Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 s: J9 p' Y* j$ ?7 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* i% u$ j# G4 x' v, b2 n. L2 w: b
else2 z" t9 v% W1 R6 |# b2 ]- ]% h1 J
cross_marquee.style.left=marqueewidth+8
* \* J  z; h, @" d$ z
, g# u6 ]8 g' b3 j; Z: F# o7 o}7 N1 A. U9 O3 E- u/ @9 p9 {5 U4 V7 v( k# @
else if (document.layers){
' [/ @  a7 s5 Y2 `if (ns_marquee.left>(actualwidth*(-1)+8))" z6 o7 g5 s9 t: g
ns_marquee.left-=copyspeed( A7 u* m: _  [% L
else  p2 `2 H  W( D
ns_marquee.left=marqueewidth+8- @! Y- _* O3 Q
}5 x/ j4 W: s# P2 f; M! r/ V
}8 G) s4 `1 c2 f! d

, P( E% V  M# C, r/ M6 m& Vif (iedom||document.layers){9 z5 }$ a* N7 D4 Q& p, F
with (document){4 k! |8 R& k# ^6 ]3 A9 @- W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( }. I9 l1 v1 E! ?1 @+ h) tif (iedom){
" m! C3 [+ S) |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. Q4 c1 `6 Z( M2 _* Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ R" V# z; @2 |5 |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) D- G# ~) D1 Q( o* Vwrite('</div>'): ^8 N1 R. H/ m  v( r% Y+ S
}% D1 s5 O. A4 X! \1 ^2 R
else if (document.layers){. S" ^3 J' x  v" _' p) J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" Q% ?+ s* }/ x7 [$ |. }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% H( u0 C0 s0 |$ v$ @8 C# Gwrite('</ilayer>')5 }$ v0 a& L, L& {2 h
}
+ N1 N% E9 I' M( f+ K! Ndocument.write('</td></table>')
  Q4 P9 N; f( ?% `}
* C9 b$ }( |+ C. \}
  H- t5 O! P, K+ y& O</script>

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