返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# y  r  J! T  L% ^5 ivar marqueewidth=3008 b$ c0 Y7 Z& {$ y! a( e5 ~
//高度
, X$ s/ h9 m4 w  v& Bvar marqueeheight=25
6 ^. ?, e$ H4 H# T+ J/ r8 D6 {- Z; V//速度(1-10)$ P9 ]$ g+ q8 V9 e& q7 a8 b
var marqueespeed=3- ^) P! H, x1 @9 J! C
//背景颜色
* a3 s7 v9 G3 ^+ |+ U# cvar marqueebgcolor="#FFFFFF"/ h! u) |6 R( {$ |4 \! O3 L& [4 f: ~
//是否能暂停 (0=no. 1=yes)?
. B1 o- ~1 u- W+ Dvar pauseit=1* |& T/ w  f( ?. j. F: ]
6 S: ~) I6 j' \3 K, @
//修改显示内容. c$ m" Y  z' D3 ^0 M2 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ i( M+ @3 `+ s  k7 z. s) g, k+ ]2 {; Z! O

( _8 S0 B! \+ s8 p////下面不需改变////////////
. C7 ?! `- Y, ^3 B( D0 e8 f/ K% P& B( G! W
var copyspeed=marqueespeed
- u. m+ u# V0 w! k1 zvar pausespeed=(pauseit==0)? copyspeed: 09 D( z' a' \# a& s
var iedom=document.all||document.getElementById4 ^$ D  X2 y; i5 U
if (iedom)
' v" I1 i+ P1 @' C6 l) m- |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 s& @( V) \' W0 ?& i
var actualwidth=''+ c1 r/ R( u( H8 g! q
var cross_marquee, ns_marquee
% e8 L7 Q2 i% a$ G: A
$ ?. ^1 r/ a* i0 Tfunction populate(){9 A+ T2 l0 n1 H  z  I7 t
if (iedom){7 X' D. P& d  ~, X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 I: ^5 j3 m8 o
cross_marquee.style.left=marqueewidth+82 G' e9 m9 z: Z2 m  E2 I$ N
cross_marquee.innerHTML=marqueecontent4 Y( Z5 ]' J3 Y: w9 k' C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- q3 v5 x, N6 v# V; `2 o- R* ~0 X
}0 K0 ]0 I, ^& f$ u# |
else if (document.layers){
" C- M) P4 [6 D: d5 t& i/ U; {ns_marquee=document.ns_marquee.document.ns_marquee2
4 z; @* \/ o& l) ?ns_marquee.left=marqueewidth+8
- x1 E; \1 h4 Lns_marquee.document.write(marqueecontent), a  N1 D; s- m
ns_marquee.document.close()
1 s5 G0 W# H! ]0 H+ mactualwidth=ns_marquee.document.width) M# ~  c& {8 y- k2 g
}
1 Z8 Q0 D3 r+ `$ x& L- L$ F, Slefttime=setInterval("scrollmarquee()",20)& x4 K+ o+ |" T) p: x
}. o  U) J: |# e7 q& s% n
window.onload=populate
0 [8 g+ w! _- a* P; F$ c# o0 |" d" H: Y/ X/ `& P$ d! b
function scrollmarquee(){+ f( t! o$ ?/ w& Q' X
if (iedom){
$ \2 a2 Q0 k! c, ^' \; f, _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. ^- _1 m. e8 b8 ~2 a! kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 k: g6 v+ I; a8 P
else2 E1 _/ v, ?6 L3 M% M7 g
cross_marquee.style.left=marqueewidth+8, C) E3 S7 X7 U$ [. a' A2 e

4 x5 ^  }  ^/ U+ h3 X}8 O/ l, y/ D6 p* E) `; Q
else if (document.layers){
. ?0 I2 w8 T. f) }7 b' c# Lif (ns_marquee.left>(actualwidth*(-1)+8))
# U; R: h4 a1 x: e) e4 I8 G. b+ H, kns_marquee.left-=copyspeed
( W7 k% ]( _* s: m7 y0 O+ X5 eelse+ d8 Z! V$ F8 C9 X( G. |/ Q
ns_marquee.left=marqueewidth+8
: ?. J; {9 N, |1 h}
. l, X+ B  }2 f) N}
" }' k4 b! s9 G/ J+ [: r7 X" l! f# }0 j/ p
if (iedom||document.layers){& [6 D$ c; L5 B7 }) ?2 h
with (document){/ k7 }  O) Z$ {" z% ?/ C# G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* O: Y& z- ]+ B: ]: @! K
if (iedom){
, F2 g" R. \; n* Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! g* T% a$ _7 c! T+ M2 J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! |2 y" \: h' b2 M  Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" E0 @* l0 c4 i: @; S" owrite('</div>')
" s) ]( K$ `  \  _. i! m}
- J# }! O( r2 relse if (document.layers){( }: H9 G" c, }; o: J: ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- E6 B$ k4 H8 N% Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ @, a! Z( u3 P4 }9 ]
write('</ilayer>')* m0 k4 N- a+ [' N
}
  C8 b. m  ?: G4 c' s! P$ N; [document.write('</td></table>'), S6 k+ G$ W" ]* y8 E8 z1 C
}, P& W5 Y; B: }
}
! Z, |: I( x* l* x4 l</script>

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