返回列表 发帖

网页之跑马灯文字特效

//修改宽度' I9 q, R9 P+ z$ \  D
var marqueewidth=300
* b+ c! o2 F8 b* \//高度
! Q& }2 r1 \1 H# I) d9 Pvar marqueeheight=25! t, W2 M# e/ F( v' E
//速度(1-10)
+ Y" N0 I, ~0 p3 F5 X8 Nvar marqueespeed=3( J9 M* p( q8 J
//背景颜色; d- n" ^+ ~/ d, m! g# w( s, l
var marqueebgcolor="#FFFFFF"' G% P; H& B% Z5 y
//是否能暂停 (0=no. 1=yes)?* W. N% \; O3 B! l+ R- [. Q
var pauseit=1
( c8 I& G% O' a7 l' Y  D% O! m& G1 g* l; s
//修改显示内容
! E0 w& P7 x9 _2 a) P2 xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 o3 D8 o, S4 B6 e" Y
4 Z( M4 W# `7 D) b# \' h
) k. q4 P" ~8 H3 N6 X& |////下面不需改变////////////
  r$ C9 O* k7 }% ]+ d; _# B/ K  F$ z% p7 S0 ]7 `( a+ a
var copyspeed=marqueespeed
; X- I' A8 O4 |4 @3 mvar pausespeed=(pauseit==0)? copyspeed: 0
/ z& P" e* Z7 e3 Uvar iedom=document.all||document.getElementById
  }  R1 I. a& A8 ?) w% b& Vif (iedom)
: Y: I: y, m* H; [; E* ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 v# ]' [4 @+ M1 L( C+ r* M
var actualwidth=''
0 S! |' N" X* W9 evar cross_marquee, ns_marquee/ C# j" H5 T4 F
$ d* v# S$ O6 t( i" {7 d2 P
function populate(){
4 ^1 x' c& {! d+ Qif (iedom){: A8 R* m2 L' c, k3 H/ |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! ^* _+ {' p; ucross_marquee.style.left=marqueewidth+8/ G6 M4 a) V# O1 y9 q! ?" I/ r
cross_marquee.innerHTML=marqueecontent7 Y8 P6 Z0 C, R  t5 f  ~. P' j8 t$ ]$ @# v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( G) O, `9 j( T0 p; h/ C}
# c8 |7 a' i, X" o8 t; helse if (document.layers){6 z+ G. I( O) e- d% j7 N' D
ns_marquee=document.ns_marquee.document.ns_marquee2# b: T4 v; N9 B. [/ p% A
ns_marquee.left=marqueewidth+8
, P. z, K+ w; yns_marquee.document.write(marqueecontent)1 i8 g9 z+ p& O# }
ns_marquee.document.close()
# |# V% E3 e+ G4 l8 factualwidth=ns_marquee.document.width
- l+ s% o0 V. u9 g1 g8 K3 I6 Q}
- ], N' @; v5 r+ J4 L; \lefttime=setInterval("scrollmarquee()",20)) K/ w0 p/ ]6 {% k, w
}, I% T. }( k0 Z# D& s
window.onload=populate7 H: [1 {; f0 S3 r5 O
6 i+ r/ h, T( ]: z+ S
function scrollmarquee(){
! p* I7 y) @3 N' n+ [: H8 nif (iedom){
6 l7 o6 `2 a- m- E$ Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 |" s2 a" ]8 o" ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: V  S  t! U0 |; k
else5 U5 L3 G5 k# b( G
cross_marquee.style.left=marqueewidth+8
6 U7 q% x/ o5 S( j4 i7 ^
  i- P3 I: G" i- B( ]" F}# E- D7 F& w( S. M
else if (document.layers){
* [6 E+ P$ H( ~% k+ P7 _- aif (ns_marquee.left>(actualwidth*(-1)+8))! G$ G2 Y9 W1 Q
ns_marquee.left-=copyspeed" X) V+ p& I6 A  x4 n
else7 z+ Z( l/ x0 v) _0 h3 n: ~/ w. E
ns_marquee.left=marqueewidth+8" h" b  b2 Q5 z* w
}
. Z9 F* h# e5 ~; ]! E7 ^5 Y( m}  ^: Z; q4 Y* |  ~( K1 f7 K, ?
+ J( p- z: v5 u
if (iedom||document.layers){$ X- x! X8 f! Y3 g# f( u9 V6 x
with (document){  x$ B" Y$ |2 G8 v- y6 w4 {! b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 A, y2 U: ?/ w  v; P% F: [
if (iedom){3 _0 @$ ^" D$ z, c4 Y4 c2 A3 f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): b: w" S9 a3 B0 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ T" f+ X, T0 J3 N" G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( S; {/ v6 @7 P
write('</div>')' e3 P, h( d6 Y
}6 H! L. z7 d: m  X* p8 V5 J
else if (document.layers){3 P/ |# L" p9 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); K: a- Z& a% d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): N, c3 l0 E" q/ J; c7 R" @
write('</ilayer>'), ]7 b& E  l8 P( H" J
}
  t+ B) p! t. L, [9 K2 Ddocument.write('</td></table>')3 ?+ h* D; J$ T
}
4 m5 Y$ C2 {; F: f7 _& u}* K1 y: v. v( z0 T- `& o
</script>

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