Board logo

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

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

//修改宽度9 G4 W0 ~% e3 E- C; A/ \: A6 i
var marqueewidth=300
! z$ i8 ]2 [% E  b  g//高度9 ^/ C' E7 T" ~% a8 ]% w" z
var marqueeheight=25
1 P5 _7 F; g3 D. w5 E5 i6 P. o: _//速度(1-10)8 O& U6 Q$ q. j* S) Z
var marqueespeed=3
; ^! G2 I4 `  P2 A//背景颜色0 w& x; r% N. H2 \9 h
var marqueebgcolor="#FFFFFF". t/ o3 n2 q$ P1 @
//是否能暂停 (0=no. 1=yes)?
- \! o( K) s6 W0 W" xvar pauseit=1
* o% [& s7 d6 U# i6 P) d1 I0 C! k) W; F8 f+ A7 H
//修改显示内容- d! a3 p/ }$ K. a3 N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ n" D+ G, l+ o! \) k; ]: v( v

) S9 @6 r" l+ T. a, ^7 h7 M% g6 q0 E9 N9 s) w/ o
////下面不需改变////////////: N$ ?# A9 m" n8 O
, S5 q' F. N- m) R6 |
var copyspeed=marqueespeed
% N; ?4 t2 o% g4 Q- ^+ Qvar pausespeed=(pauseit==0)? copyspeed: 0
) k/ q  A  Y" J$ P( C0 xvar iedom=document.all||document.getElementById
- L7 X1 M- n$ [" f/ T, Gif (iedom)
! {' ]- C8 r9 N; s3 _8 q1 g! P6 K! Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- S" c& J( H2 m! j3 a( T* k7 @var actualwidth=''
$ I) N1 s. v- [: t- {& f$ s1 `var cross_marquee, ns_marquee9 O9 K, m4 R8 i) w$ l2 z
- p' @. y9 w: {4 E* \" r5 Q
function populate(){' u& M0 }8 w4 m2 K. s( i
if (iedom){$ k& G' {+ f' V, @0 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, F: q* t! N  T' g' {
cross_marquee.style.left=marqueewidth+80 H/ E, K& k8 s0 d" ]2 y6 O0 H# }) w
cross_marquee.innerHTML=marqueecontent
5 L9 N! t  b; _1 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 P% |/ C! h) W! c2 J  N% x3 G
}
! J3 v) r! e$ C2 W7 Kelse if (document.layers){
, g5 ]/ a# f5 b8 y& Z) \6 n, Z, Ons_marquee=document.ns_marquee.document.ns_marquee2
2 C% j2 x; _# J! Q  ]3 W& z- o  ins_marquee.left=marqueewidth+85 l9 G# g( X, R/ z3 Z8 W
ns_marquee.document.write(marqueecontent)
8 R6 l, l% v  }* I! y; k8 J# Rns_marquee.document.close()$ N* p! H2 M+ n
actualwidth=ns_marquee.document.width
+ o( K' g" W# i0 \1 D+ Y}& n. {) W- H/ w4 i$ U6 l1 C3 Y
lefttime=setInterval("scrollmarquee()",20)
% ~0 F* t. H9 t8 _}. U0 ]3 U9 @: P& t/ ?( q8 b, y4 c
window.onload=populate4 i4 d) X, {2 ~
, |3 d3 C& N! L, i7 c5 j
function scrollmarquee(){& k7 B  ^5 p+ n7 b% R7 }
if (iedom){  @/ _2 s" L# U( R! b' ^4 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 y+ J' C8 c) b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: @8 `. z* c1 [# C  U" d( Q
else( f- ]3 C* O5 M
cross_marquee.style.left=marqueewidth+8
% R7 }6 ]3 z/ [3 e# F) i  l
5 T% K; A# q8 N( s; A% |% W5 t}  o! v' t9 E8 I$ E% R
else if (document.layers){
8 _$ }2 ]$ j6 p' gif (ns_marquee.left>(actualwidth*(-1)+8)); ]$ S/ S/ W7 L4 s8 ^, s, _$ _' B
ns_marquee.left-=copyspeed
7 g0 S  O6 @: U0 C1 \else5 j" Y, m3 h" \2 f7 [% `
ns_marquee.left=marqueewidth+8& u- ~! w( f# O. h  W- P
}; x* I% E1 d( ^0 p% b( D
}
3 z3 z8 D2 ]; a8 y- N' ^/ J* t3 ^' i
if (iedom||document.layers){
/ w9 S4 G' m, I8 q1 a8 owith (document){
, Q4 g0 `8 S5 K* wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): R7 E, t# ~# E
if (iedom){$ r9 F9 O" N! b2 o3 ^6 J0 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): o2 @  V% v1 z: n' e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% a3 }5 _/ v0 B! R* J8 o% I2 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. @) K% x/ ]4 X" d+ Awrite('</div>')6 q# q2 j* [$ `. N; F8 r
}, f4 }* i5 m, C
else if (document.layers){
) y6 x# M8 z: E3 ?+ {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 `5 C& N! F/ @4 Q6 J9 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' ]' Z# V2 F9 e% u% }1 Jwrite('</ilayer>')4 n" G( }5 e& c% Z7 }: T& K: ^& C
}
8 t6 t% @9 u" N$ b2 mdocument.write('</td></table>'): x4 h' {3 E, R  O* p9 G7 _
}
! N7 N4 v% W" C5 ^0 M+ p$ }}& ?# Z) W- `% k( M& ?, C5 Z
</script>




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