返回列表 发帖

网页之跑马灯文字特效

//修改宽度: d% m( y$ ]/ A2 o  \
var marqueewidth=300# I9 n* r, c0 u
//高度
5 G, p  z8 H& V* T' T1 s0 {) ~$ svar marqueeheight=25
3 q" t/ q/ b7 X& D: F//速度(1-10)
# H2 x: j* _& u0 Q$ ]6 A, rvar marqueespeed=3- E. M1 t7 f% x; l; V6 C, P
//背景颜色
6 k4 y0 h" `; `% tvar marqueebgcolor="#FFFFFF"& Y/ M: ^. b& K1 e* J# x5 o( c% u
//是否能暂停 (0=no. 1=yes)?
5 w7 T; p+ E" A+ F: a7 _0 s4 Qvar pauseit=1( d# G4 Z  i! T9 y

& ]8 [; Z) f, |//修改显示内容
: _# H# m# N% J: _" U1 Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ f$ N4 _' g; o3 M5 l0 _/ B% Y9 o

; L) K7 K1 w  a
- @0 _1 k% a/ s2 q* R////下面不需改变////////////
, V7 W- Z, m7 F! c$ E  @& ~) W% _4 X# s) O
var copyspeed=marqueespeed% L: l$ A0 P% l% Q6 r. ]
var pausespeed=(pauseit==0)? copyspeed: 0
! L4 p4 i( }' qvar iedom=document.all||document.getElementById
3 }9 j7 w9 ^0 ^! Qif (iedom)
& G1 g# k) h, o7 y/ u: Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). d  U) _( ?' |$ D% C
var actualwidth=''
7 G2 Y! n. _5 U& yvar cross_marquee, ns_marquee+ K& @. o$ p/ m( j, P
3 r7 N, b. U( E3 G3 x7 i
function populate(){
: I6 f, x7 k, ]* x1 H- zif (iedom){
; `) h, I2 B2 R, Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 ]. ?, z2 p% ~( i) k" j; d+ xcross_marquee.style.left=marqueewidth+8: `# P+ Z- S3 p$ X+ K& p9 ^! r
cross_marquee.innerHTML=marqueecontent
% p, ]; M" y: X4 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ e$ r. b( x  K1 n' X( `. M& N5 s
}4 Z  y0 x' d; N2 U' `' m" ~
else if (document.layers){
7 x0 s$ W. @  {9 r3 ?! z! ?: W2 mns_marquee=document.ns_marquee.document.ns_marquee2
8 z6 ^0 b! `  G- S6 Uns_marquee.left=marqueewidth+8
: |5 z: f9 k* F  A, }0 G& o: B4 l% Rns_marquee.document.write(marqueecontent)
, C& U% j: ^: m) U* ^" ^ns_marquee.document.close()
! C* L0 M1 k  ~' e# pactualwidth=ns_marquee.document.width7 d* R  b; ~( c
}
/ [, F' R/ j, \" @# g% tlefttime=setInterval("scrollmarquee()",20)' z; q: y% Z8 I! T; Q2 ]' {
}; i3 r& R2 ^" j/ s& w
window.onload=populate
5 r( a0 b& b1 j/ T+ ]* K; \; o* i. Y, z3 |$ q6 S6 i
function scrollmarquee(){
+ g% p0 U8 l# v9 T% ?if (iedom){3 C) T$ e$ |, P% E; f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' O$ k6 z1 O4 k/ q# X8 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% J; L) u+ X# ?* ~9 a9 K& o8 i  C( P
else7 U  d% w- _# `0 k. i4 s5 Q
cross_marquee.style.left=marqueewidth+8
; u. I- ~1 m5 h, T& H% `
; Z, O4 K) j% j) B6 Z" e: j2 ]! R}* f% ]9 f2 A* [' O$ C+ ?; x& z
else if (document.layers){
  @9 x- J. ?/ b2 l7 f; \if (ns_marquee.left>(actualwidth*(-1)+8))# u4 ], {4 D  H# H, ~/ z( Z" s
ns_marquee.left-=copyspeed9 R7 p8 l! M- I- `
else
/ S2 z+ E% G( ^ns_marquee.left=marqueewidth+8, p+ Z& }8 `+ u- S8 v0 A* `
}3 Q! A2 O% F: J, A
}- `' h. J' j1 f, Q4 R; @2 w( r

' r( \, S% {. I! e9 @3 Pif (iedom||document.layers){
) L' ~4 i1 E1 ~9 c% a: L1 Z, ~/ `with (document){; ~0 C' n% b- R8 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( V; [+ d8 s3 Z9 }$ r2 uif (iedom){
) m1 i" c. D7 T' a0 ^# }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- Z* Y; {  _. I2 ?5 D6 u: s1 H0 ]- twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& E, @2 U4 V8 M' X( P  W; \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 d) {3 g, x* ?# x
write('</div>')
4 @& Q/ t( K% _( l) d}# D3 U  D" W( V: A1 y, Y: `2 y+ w
else if (document.layers){9 a& j! P! x. S0 z4 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- y5 x2 y" t+ C' J) c4 U% c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 U* i4 e1 e/ ?$ W. {6 G8 m; _
write('</ilayer>')5 T' |, O! ?7 _$ c6 u: L6 K
}
7 L, J( c+ c* j6 M& m" zdocument.write('</td></table>')
% p4 y4 `) v0 i, Y}6 X- z, ]" a8 _, C# ~
}$ R9 T/ A4 B: J& y# ]0 u; X
</script>

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