Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
4 h" k4 y' m0 ?; d) x: uvar marqueewidth=300; d. [9 X1 W& N+ r
//高度
5 U/ w; x: d" n" y; p$ H6 nvar marqueeheight=25) S; q0 J5 P% o: ^' P& |
//速度(1-10)& v0 o  X" U. w$ ~# Q
var marqueespeed=3+ ^1 X- k2 g7 u# V( S
//背景颜色/ j/ p8 r6 Z( ]. Z' X
var marqueebgcolor="#FFFFFF"$ U! m2 j( t0 ~+ G
//是否能暂停 (0=no. 1=yes)?
! A% V% ?: e7 }! S! P, Bvar pauseit=10 q. I9 a( ~. F

8 b5 I  P9 T6 `2 T$ {5 d//修改显示内容
1 `. i, G( ?7 t$ ?# @7 p6 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' a& E7 G5 B" z# e4 r0 C3 j1 k1 K
3 d$ V! n4 q2 _
////下面不需改变////////////  v% k- t+ ^' u

0 X; u1 s, }+ W* ^var copyspeed=marqueespeed. w# x; m) }( y' y, c- f& K$ ^
var pausespeed=(pauseit==0)? copyspeed: 0; ^) D' x. ]9 f6 E$ T1 G
var iedom=document.all||document.getElementById3 v/ z4 M/ c8 F. _
if (iedom)
' e3 N+ u+ \+ m/ e* Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 M2 f9 g& t5 R3 I
var actualwidth=''& o: _0 I. K1 ]: n2 a
var cross_marquee, ns_marquee# q2 p: U1 g: _) T; s4 T) O# v

7 ?* z+ ]2 |! {function populate(){5 Y4 {. Z& b# o! y, G# S" |
if (iedom){1 _- i( ]6 N! l( c' ~% i* H
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& c% m2 m. }  x5 y5 icross_marquee.style.left=marqueewidth+8: _4 i5 ~$ N* Z( f& j% g1 t
cross_marquee.innerHTML=marqueecontent
3 f, h$ E8 f% [7 k$ Z( ?5 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% b  g. j2 ~8 _}
1 N8 ^. m4 l% j, L4 \% ?else if (document.layers){: H$ o; X3 F. g
ns_marquee=document.ns_marquee.document.ns_marquee2, w5 H2 K7 w- _3 I. S3 U
ns_marquee.left=marqueewidth+8
; f9 [5 x* P* |' n; o3 G0 G) cns_marquee.document.write(marqueecontent)
& U9 x; A+ d, Jns_marquee.document.close()
* [3 ]$ @; w- W4 H* ?actualwidth=ns_marquee.document.width9 ~# w7 M1 e/ }
}
( j% ~: o$ U) z1 C; elefttime=setInterval("scrollmarquee()",20)
& X& p! k- j( K8 V. C" R: ]: Y# {}; t2 }$ ?8 `( t: ^7 [
window.onload=populate* N9 m8 v& f5 u* `$ `

0 l4 N* x8 O! p# xfunction scrollmarquee(){
! x' w- ]0 L+ B5 R; D- iif (iedom){3 w7 j: |. z: `! `* v( S; g9 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ~: r" t6 ^: n$ j% A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ u( P. C0 c2 T( ]
else
: r1 C# N8 ^6 g. h1 icross_marquee.style.left=marqueewidth+8$ E$ D! `+ ^! a) M: p) d- r
4 i  k! N3 O) ~4 S+ P% O
}8 U9 N; `) x) r
else if (document.layers){2 W- G! B# A, x, b  R4 S
if (ns_marquee.left>(actualwidth*(-1)+8))
. r" `  x* Y! x& Tns_marquee.left-=copyspeed
: i5 C% H" o  w2 t7 _else9 `1 X# f% M2 x) a/ a
ns_marquee.left=marqueewidth+8: K+ r4 I6 q$ w% o) H9 K9 O9 E6 N
}
% Z; \. S* B6 x" h4 f) a}; g- v; d3 P8 s, s' X0 J. L! I& ^, D  {
/ u0 `6 k7 k7 `! U3 }6 _2 l4 b
if (iedom||document.layers){% y& `; ]. [$ m& _
with (document){7 l( d/ [+ S! \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 O, j/ `! [- X9 g# i, g! n
if (iedom){/ A0 y# @* T' U8 ]! J; ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) l( }' b" t3 f) [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): @7 b( Q) h8 d' [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 n. n+ S, g( O
write('</div>')
) Q+ T* v2 k) q8 D2 o2 F9 l# s}1 Q' c) a( ?' d: g# W1 G
else if (document.layers){2 `* J, d( F8 z0 W. A! W% O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: l6 e' V6 w8 d9 j+ Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! S  v! Y' A3 f' R" swrite('</ilayer>')
2 `+ Q( J: [8 x8 {}
9 j* k; ~- [3 X4 Gdocument.write('</td></table>')
( N. r1 T  K, D. ~/ u}+ B- K* n5 |9 D6 J6 `+ H
}
' L7 `1 y3 p6 G& `5 E</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2