返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# p9 a) ]* I. v; N/ ?* Kvar marqueewidth=300/ b" a  V. |* N6 P$ {
//高度
/ y! d9 b8 L9 r% M: a* s0 ivar marqueeheight=25, q5 d' `7 ^: i2 M4 y
//速度(1-10)
- w+ |# Y- h* jvar marqueespeed=3* Z) p! F3 ^$ Q2 y5 @3 p
//背景颜色' Q4 j1 Y( h6 P. J7 a0 j- m
var marqueebgcolor="#FFFFFF"; H) k! ~& |8 N- x2 F, c5 t! ?
//是否能暂停 (0=no. 1=yes)?
. I8 w( ^9 t8 ]) e; evar pauseit=1
2 z+ `/ i% K7 I5 ]! z
0 _8 z+ X0 c+ U0 b8 Q; g. a//修改显示内容
7 ~& `/ B( M- a$ W/ bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- ^. u  ^0 g8 r4 k& y1 J' y

& D; m4 B+ M. k) t$ `
4 O9 W/ @9 D+ K6 K+ ]8 f////下面不需改变////////////
" ^: S8 C0 f8 S: |( f) R: u- S7 ^, C* ]2 K. |" d* F
var copyspeed=marqueespeed
, t$ W3 H- S4 v4 X; T2 L) |var pausespeed=(pauseit==0)? copyspeed: 06 j+ X/ H0 |. f5 B! M7 z6 a) u
var iedom=document.all||document.getElementById) H$ A# z, X. i9 j
if (iedom)
3 W( H7 V1 |5 x. Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 \$ o8 W9 ^% g, k# b% X" X
var actualwidth=''
. J) N. A2 `7 x3 q; {. Hvar cross_marquee, ns_marquee( \) ~1 s7 L$ S3 t* W( `8 U
& U( `# {# v- z7 B
function populate(){
4 ]# I: r2 l& x' `if (iedom){/ q6 i+ z5 t( j3 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; h' }- W5 X; U2 F0 q
cross_marquee.style.left=marqueewidth+8/ v/ K7 a. E' ?8 s# b
cross_marquee.innerHTML=marqueecontent
& U+ L" ?% ^: P  |( @+ Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( `$ w; y/ Z' v: Q1 ^( i
}
, k7 Y) a5 D7 g4 `7 m+ D; M3 u6 P$ Telse if (document.layers){
) C- d( _# c4 j/ ?+ i. {ns_marquee=document.ns_marquee.document.ns_marquee2  g! t: ]0 S" b; Z
ns_marquee.left=marqueewidth+8  v  e# m+ a5 @7 @
ns_marquee.document.write(marqueecontent)  m* C" c$ i+ n) C7 e! y0 V
ns_marquee.document.close()
! G+ D9 J! E3 B3 Nactualwidth=ns_marquee.document.width/ t7 L' F! Z$ h1 b; H. {, X. u
}* k* H% S2 n' s. N! h' t* q
lefttime=setInterval("scrollmarquee()",20)
: Z5 F1 b5 @9 j}
5 p- |. I2 B  A* f& B9 twindow.onload=populate1 D; f! d: c# i$ G, q1 t. \
0 Q2 D% h9 T1 u- y/ Z% O
function scrollmarquee(){0 v9 ?6 z2 I+ \6 f) @3 ^& M
if (iedom){" `3 \# D0 |4 O1 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* A- d1 |6 |- d: X2 I" S/ Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( U7 |( z9 P& ]. C; M; R5 N
else
4 |3 A* {6 X; v4 [/ B/ @/ e9 m, ]cross_marquee.style.left=marqueewidth+8
& Z4 T' ^7 y9 e7 F0 C1 @. s, t2 V, W7 Q) j" x8 m+ ?, L$ T
}
! ]- g. o: v& O: f9 eelse if (document.layers){/ q/ G2 t; x0 }3 x; F1 H4 W1 v) y
if (ns_marquee.left>(actualwidth*(-1)+8))
, e4 I. `1 ]" Q/ H/ _) o8 rns_marquee.left-=copyspeed  _7 G: T+ z; S. s6 x  }4 Z
else
& E1 B6 R3 `% p8 v1 Lns_marquee.left=marqueewidth+8
) \/ G, U! ~" N}$ M# C' V( w: C  b1 g' e
}
$ L+ ?% Z/ x/ }. E; ~
% s3 M, e8 p9 U6 D* A5 Tif (iedom||document.layers){" S/ q0 X$ U$ {7 ]
with (document){/ n, f# v5 B; x1 a2 E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 ^( `5 X* {4 s- c8 P) Iif (iedom){
+ o( ?& _6 m, ]( s6 {0 \: @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): J0 \  f$ d) P( V1 T( }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. ]- P8 Z- b8 J( ?$ O* g! Z  Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 p8 u$ \& F" t9 g- |) O
write('</div>')5 g% h- }% \1 A! H' r
}7 ?4 }& D( i7 ?  o& Z
else if (document.layers){
4 N# d; j. e9 U" x% [# Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  D* a: z2 G% H# q- p: mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; m# W; j7 ~0 qwrite('</ilayer>')! N% K" b+ [; P  L
}) _$ t6 \$ x( e4 }3 ~3 D; m* D
document.write('</td></table>')
2 e4 a3 s' q  y; m# N$ J$ D}
' |1 X$ a( F: y: H/ V}4 |$ F" \( V  J( X8 u2 C0 f
</script>

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