Board logo

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

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

//修改宽度
" t. I* t2 |: C# x  J" svar marqueewidth=300
6 b4 L" D! t. y+ A: B5 l//高度
  ^' B3 V$ x, t* Q2 l3 Hvar marqueeheight=25
6 X. v! \0 R; T! k//速度(1-10)
; V  \9 S5 b" o- Hvar marqueespeed=3+ f, |7 i. m* z% @
//背景颜色9 m' ], X: A' x- l
var marqueebgcolor="#FFFFFF"
& }1 q. Y) W" x; k1 G//是否能暂停 (0=no. 1=yes)?% z( k5 A8 N" [
var pauseit=1* Q2 `1 a; i. m$ b0 y. L
$ ?5 F; B& }" j# i
//修改显示内容
8 A4 s* N0 d* ]6 Z& y1 `- tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% B8 i  J2 `, ^' C& H7 I

7 |8 a/ o" W& J6 k( d: i8 Z! a+ i+ ]$ E0 R# F3 U9 Y
////下面不需改变////////////; f- t8 K7 g6 X
8 Z" @: m* W' D7 P; ]/ I
var copyspeed=marqueespeed6 ]" c- E; W( C, m
var pausespeed=(pauseit==0)? copyspeed: 0
( r( i6 r$ [6 ivar iedom=document.all||document.getElementById
/ }. |+ p( ?8 b$ s; aif (iedom)' F; C8 W6 l1 F( w! f/ A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* H# Q. y1 K$ Y7 svar actualwidth=''$ c. C: H, i1 O! }1 ?3 F: a& G( ~$ V
var cross_marquee, ns_marquee3 N/ t" V2 I  z$ f0 D' ^7 q( L

5 {& R& {, i# Q, s+ ?! Lfunction populate(){( {2 w$ H: [, w- {4 u3 r8 b5 Z' D
if (iedom){
' W5 R8 Z& L- q- rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 z# N7 P% {; e% U9 u* Z( o& c
cross_marquee.style.left=marqueewidth+8
" u! H  n$ i4 P3 Ocross_marquee.innerHTML=marqueecontent: s) `" N6 y% O8 P3 }+ a  U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. I: ]  ^" @4 ]+ Y  {3 p2 @}9 T/ {' q/ X; Y$ U# ~
else if (document.layers){# [0 J) u+ f6 \, ?; K; d( v
ns_marquee=document.ns_marquee.document.ns_marquee29 R' Y- V7 K5 Y* P4 n  t& ]
ns_marquee.left=marqueewidth+8/ \1 W: D. J, X  l- B7 R' m8 ]3 N# c
ns_marquee.document.write(marqueecontent)2 r; i* `1 z% K& m1 P; k
ns_marquee.document.close()- o& z6 v7 D8 t- M  b5 k
actualwidth=ns_marquee.document.width
  A* N( {- L4 s& ~, y}. ^$ k% L: `2 D
lefttime=setInterval("scrollmarquee()",20)7 C7 ]# A. t0 T% I$ L! C  w
}/ s9 Y. u; D1 a+ V0 h5 c
window.onload=populate
5 a7 q  [( O- T) Y* s/ I5 o$ |
) R5 H2 f- Y& n$ R3 ~) {function scrollmarquee(){. d, X. R  }+ a9 P3 O5 v: A* O
if (iedom){0 z( e3 V  j( x% N$ L1 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. O$ l; y- E8 a( C2 C, M/ rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 d* \: x/ T0 t7 k
else
5 r1 Q* H# h5 L2 w1 ^  T5 Rcross_marquee.style.left=marqueewidth+8. p# u! c! Y4 F
+ c* d0 b, g5 x% M; Q: y
}) l# V6 ~+ @; x3 P: p* x
else if (document.layers){
6 \, X, Q7 H; g2 `, G! Dif (ns_marquee.left>(actualwidth*(-1)+8))+ B$ Y; C+ B9 ]) a
ns_marquee.left-=copyspeed
0 I! t) g. E% N- O* aelse4 o% a( _2 ~: a4 ~$ I. f$ y1 p
ns_marquee.left=marqueewidth+8- i4 O& T+ h% N0 @9 ]8 ]& M( {
}
' e) ~0 \5 s5 j; W- b1 y$ r1 l}8 @) Z5 {5 j4 Q$ K. v. `/ h
4 z% u5 }/ ]2 q# A  t4 v; @$ o
if (iedom||document.layers){/ N8 k  b9 ]$ Y
with (document){) ^8 h0 E3 x9 Y) t% A# S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ [" Z- L1 s5 g. ?- ^% S+ }
if (iedom){
( |- k$ O! I1 m) Y  hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) k" L, F% o, S( \4 y# iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 m- `$ @" H; I/ Q# `+ }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ }" r* x( ]. Y% T! c3 dwrite('</div>')
' P- j% V+ d* p! h% W% b" H}4 M3 i/ U. c9 g' n
else if (document.layers){  u- Q2 P6 ~+ @6 {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 Y0 N0 L! Y1 W7 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% r! X: l5 `: _& B/ s7 M
write('</ilayer>')
  I% T6 L1 ]; `$ y}5 F* N0 N8 ^2 p
document.write('</td></table>')
& Q$ u; b7 I9 q& r# n1 Z# d}" Y& E& K8 y* }/ m4 @
}
  D0 T/ i2 [7 n5 z! B</script>




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