Board logo

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

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

//修改宽度
' r* K; [% q( |/ [' x0 uvar marqueewidth=300. ~8 f5 D9 j5 A; D5 {$ D( \8 @0 y7 ~
//高度
) B8 n1 v5 S: W* I+ ^8 q5 z( yvar marqueeheight=25
! I. I! i! c* A0 U) k$ \( ^//速度(1-10)/ X" |8 |/ T7 q9 q1 K
var marqueespeed=3
" |: P/ ~" I4 x. C//背景颜色8 F5 G6 q: h5 ~5 y5 R) T; f8 }
var marqueebgcolor="#FFFFFF"
2 x( |0 i7 j% J, c+ u" l5 p//是否能暂停 (0=no. 1=yes)?) T. Y' g, ~6 i! ]7 c0 U+ R9 ^# G
var pauseit=1% }  ^0 F  G$ v' Q- Z7 ?: B

7 d. \- Y7 T. F* q//修改显示内容+ i5 f7 ^, ^1 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% ^5 u3 F4 t# e
& J; V' P# Q% o3 m5 ~/ P& Q2 E

) h$ p0 ]1 p, ]+ M. v8 s////下面不需改变////////////
2 J' k. N/ W8 \+ o% p: N) V4 p* d; r9 c
var copyspeed=marqueespeed' o0 f/ S( J% @2 `
var pausespeed=(pauseit==0)? copyspeed: 0
- K5 _1 ~+ Q( G) xvar iedom=document.all||document.getElementById
# N5 J- T" p# t. d9 qif (iedom)9 x- f* z- R3 f2 D% x' Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! ]/ K/ m/ u! P- U# Rvar actualwidth=''
. i2 [- g8 r" r' Jvar cross_marquee, ns_marquee/ [9 I6 {8 D. B; _
' U. r0 n; G' z& s7 ]
function populate(){$ L* _9 `- L8 [4 y1 V: z& p7 M
if (iedom){
! \3 Y8 i* t+ k" r; }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' }5 q% N1 M' v# @. Lcross_marquee.style.left=marqueewidth+8% e5 w1 X# L  J( H
cross_marquee.innerHTML=marqueecontent
* ^: T" o' @3 J3 s  L. {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# B" q- L" X5 j" y}  B$ g1 g' }1 b2 P$ r% h, n
else if (document.layers){
* j  g/ c% _+ {ns_marquee=document.ns_marquee.document.ns_marquee20 v& ~+ J$ N* O& X( C$ H
ns_marquee.left=marqueewidth+8
9 J" a. O9 }. T/ l: }. [' p9 Q: Wns_marquee.document.write(marqueecontent)" G/ b) v& k6 i$ Y; I2 H/ @$ y1 h
ns_marquee.document.close()
% Q/ k$ j3 I! ^* m- p* D9 c' kactualwidth=ns_marquee.document.width
( y/ O4 b; H. m}2 x& E7 V  j/ S! V
lefttime=setInterval("scrollmarquee()",20)
& J0 X* l- u; j2 W8 X& ~7 V}3 Q5 K. M/ V; o
window.onload=populate
/ ?' V+ b, W  \0 r! j
3 g6 A+ x& }" [  mfunction scrollmarquee(){9 r' L) _7 i* x- e( A
if (iedom){& W6 W# g* I4 J& w) f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! ~! h8 b1 |* I& B% V0 Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% t- K, e/ Z0 e$ g) H+ @5 N# Pelse
+ W- h5 l6 R3 D8 P- g8 R" i2 rcross_marquee.style.left=marqueewidth+8
- d! d: E6 q* f7 _# a1 p3 ~  F+ ~
& y$ O8 m& w8 f9 T" s# V" X}
) K8 g2 N" ^. I& T- [" m1 xelse if (document.layers){
- r8 s0 j$ b# k  Z( nif (ns_marquee.left>(actualwidth*(-1)+8))
; _) Z5 t1 Y( fns_marquee.left-=copyspeed& w8 d) ^  n: }% Z& `$ v  R/ k% j
else
3 j3 ?/ ]! j* M2 o& I. }1 d. d2 s* w3 Pns_marquee.left=marqueewidth+8
  U+ a2 W! r& p5 _5 a}
/ l. b* O' n% X8 ]}9 b. W' r& c6 c5 y8 n

- H2 P# f! R" b. J& L. @9 h  e; {if (iedom||document.layers){
8 U/ G: N1 n# W/ @! C+ ^" ?, ewith (document){
3 T! i" ~' p6 S2 l" h3 r. J7 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 U& c3 {/ |" [/ c( j
if (iedom){
+ Q) ~. \* u6 i% awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 j5 \$ e0 G+ o# W; u' [9 b, J' Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% q3 x1 o/ p5 |8 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 k$ a" Z! K4 d  l5 Fwrite('</div>')
4 w2 P4 g7 C7 J5 [0 }}8 Z6 U, @# ]! ]3 a2 M% |; E$ g+ y7 d. A
else if (document.layers){% f. x( W2 E1 ?2 B) A9 a8 J  Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ z+ \9 t  G8 q  Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 J% u  [* J2 y1 M0 xwrite('</ilayer>')
, f3 a# J( x, ?/ H8 r( s}! n5 K4 o8 v% a# [) l& c
document.write('</td></table>')0 F: D7 h1 H2 }4 B
}
) |/ @  y9 N- ^% f+ Z( X6 M& O) J}
0 A' G! g* a6 _3 h1 P! u  F: }' R</script>




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