返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 W& F3 s7 ~1 e& W/ l; s/ D
var marqueewidth=300
6 a9 h) D" ~1 e/ ]& t8 }- D" _, H//高度; H2 M5 g* O2 A& U. s. C( l
var marqueeheight=25
% x# `' P! N7 _. W//速度(1-10)
% x4 }  O" @- [var marqueespeed=3
4 k7 C( p) j4 e; q; b! z$ U//背景颜色
2 [6 I7 `: ^& e" @' j5 G1 ovar marqueebgcolor="#FFFFFF"
2 f" {, ~, ^  t! c8 g; G//是否能暂停 (0=no. 1=yes)?
' _. Y7 V( g4 c- Jvar pauseit=1, s1 T9 `& v- q
% [" D+ U2 |$ t" G
//修改显示内容8 M8 f8 |: l* @5 {+ O: J  j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 ^1 l1 W" ?# J* [5 n% ]6 [. h
" z2 u1 X, K( ~
7 q$ S' N' [: T8 r
////下面不需改变////////////1 x1 H+ X( C3 T
5 i, j: w" r4 n% I  N) K
var copyspeed=marqueespeed- ]& t  b! n4 Q! p7 Y% B! H& T
var pausespeed=(pauseit==0)? copyspeed: 0' q& f# [: A. i
var iedom=document.all||document.getElementById
0 j9 k) s% H& _if (iedom)' L! K- _( X7 O9 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! E$ D7 f* I3 d+ h" x" X, u$ Bvar actualwidth=''! P8 V: v8 C! Z- O
var cross_marquee, ns_marquee( z, q  d+ ^( J7 T0 ]7 T
: i6 {5 n0 V* n+ {" h4 x
function populate(){: A9 Q/ P& Q3 Q
if (iedom){9 l% |2 \9 T7 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ]) I2 y+ |. s+ }- `: V7 j
cross_marquee.style.left=marqueewidth+8
8 Z6 l5 ^( F  s$ K! t3 rcross_marquee.innerHTML=marqueecontent1 |3 B+ T5 K% P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% D" y" e# t5 q, t( E9 K
}
5 V( k+ F/ ?$ b1 Jelse if (document.layers){( ^7 u8 i0 z& \& P7 C# ~  {, t$ p
ns_marquee=document.ns_marquee.document.ns_marquee2
5 Z) V$ A& q' d- j5 Ons_marquee.left=marqueewidth+8
& P! W/ t% [/ M1 C# h* i+ q+ Cns_marquee.document.write(marqueecontent)3 R, r0 u4 B  @1 {; _  o
ns_marquee.document.close()5 h6 y( X# `& g6 @
actualwidth=ns_marquee.document.width
' b5 M* f9 r# S& i}; M) B# D' y/ ^
lefttime=setInterval("scrollmarquee()",20)
6 l( E( u- b- K% K: V}$ ]: q2 v3 Y6 @- i9 q' T
window.onload=populate$ V! k  K% O# D5 e# M- e0 G- E* x

- O- B4 e& g( ifunction scrollmarquee(){
0 I4 s) O+ ]- J7 t% {. pif (iedom){
1 ]5 u6 l* ^% Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 C7 V4 s/ c4 ^" R! ]0 E: Q. V" ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% j) O+ K- L0 y- B
else7 f2 B6 G3 c* j' g
cross_marquee.style.left=marqueewidth+8
, t! X5 W; M0 R/ v2 Y5 ?4 z" Z1 v7 k3 K( {) Y4 a. o4 _
}
1 \  G  z1 {2 C3 v4 Q9 e/ kelse if (document.layers){
) C* z% c3 I4 l+ a# n' T$ dif (ns_marquee.left>(actualwidth*(-1)+8))
$ C$ s$ y( l9 N  W) p" [ns_marquee.left-=copyspeed
' p5 Y" T7 g+ l3 G: I  b! P! helse! o, d3 F2 O8 T5 U0 i' S- J& H0 P
ns_marquee.left=marqueewidth+89 _3 Z& K$ N" ?9 ~
}
- K7 C% Y7 ~, P4 v+ ]! d}
) f7 L% e9 b# H; F% Q# U$ G* w) `& N6 z) `. B& H9 j8 U
if (iedom||document.layers){
+ \5 K' f$ i" nwith (document){2 q# i3 {2 x) D# E1 {4 G/ I9 ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ K2 B: U4 ~, B' d
if (iedom){
' K$ y' S+ c& C" e$ N# U6 E6 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 L& ^! ]3 l# n" X9 N0 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ B+ ]6 T5 [5 G4 C  O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 M7 N) H* y, T
write('</div>')
+ n# ]: L8 S2 F' v3 l2 v4 k}- \% ~2 z8 J+ @3 g& \. L5 r
else if (document.layers){
- V9 }, Y) f# twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); s! @8 q& {7 E4 E0 J& P8 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! h  ?# m4 i* g" zwrite('</ilayer>')8 P' o1 O: e+ Z4 T$ }* @
}6 t, T# y( N4 `/ c; ]2 `
document.write('</td></table>')7 e( s, E# N, u' z& q
}
7 s0 f) O6 k( H" t) x" E}
( y! q6 V7 G1 K4 t; f2 N</script>

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