返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 r9 j, v0 J: k7 S1 k. I4 jvar marqueewidth=300
) t; J3 d8 B6 L, r, v//高度8 r* d5 v. Z2 y2 R' r+ Y4 ^" {# f
var marqueeheight=25# P/ B! U0 u6 \3 P) t9 Z: S
//速度(1-10)
( t2 ^2 A, i2 jvar marqueespeed=3  M; b) ]2 `2 e/ H
//背景颜色; Y- }  k/ C) v; G6 p  X$ s! S
var marqueebgcolor="#FFFFFF"
8 D5 S3 B( G4 s, f9 `6 N& l//是否能暂停 (0=no. 1=yes)?& z, x7 ]$ [- P; r
var pauseit=1
( v$ \  l! f0 R* w6 f$ G  {& Y+ i+ ?" [/ j& t
//修改显示内容
1 @! \8 i0 K, ?% c- X1 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) `4 f' \. R  w! o9 f! u
4 ]. y% o; N5 e6 D7 H4 G% s% X6 ?( D5 K1 Z$ _4 L3 Z
////下面不需改变////////////
4 B, @- F! Y0 }  b0 R8 `8 ]6 h* b" t; g# x
var copyspeed=marqueespeed
2 m# Y: ~, k5 n4 Ivar pausespeed=(pauseit==0)? copyspeed: 0
( F$ R2 N: }4 v' Fvar iedom=document.all||document.getElementById
2 Y- M& h" _/ e6 v+ c- rif (iedom)1 M- j( _* ^" |) t# A; T7 O; R3 C7 y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ L4 |2 P5 }8 J- d
var actualwidth=''
; e5 v; i( R* j) o! dvar cross_marquee, ns_marquee
) S+ j) C' y' b7 L! `; z0 w( c) c+ N2 K0 F6 U) }( M
function populate(){
! `" J$ w! x' `if (iedom){
5 P: L: P  {" {  p- n* A/ Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 J7 y, P. m$ Q9 W5 ~cross_marquee.style.left=marqueewidth+8
! q/ i* N$ A* {0 G, h1 Q* y' ncross_marquee.innerHTML=marqueecontent  X6 Q5 ~% c- s0 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; z5 o$ j) D- S5 D8 R
}
% G- |8 u% M- [9 |2 Selse if (document.layers){9 c. G4 ?5 a- s  V  M, l
ns_marquee=document.ns_marquee.document.ns_marquee2, e' U* O. X" S5 t
ns_marquee.left=marqueewidth+8
3 l) c0 @1 A8 Y9 O2 dns_marquee.document.write(marqueecontent)
1 o7 ~7 s' u6 L- d/ Cns_marquee.document.close()/ F% C( t# @4 H1 r; O+ d" Y5 }
actualwidth=ns_marquee.document.width) L6 j! |% b) y7 O' v
}$ Y, l0 `1 Y( G
lefttime=setInterval("scrollmarquee()",20)6 M0 Z, b, I9 u: s% l
}
" i; a3 y$ X; g: J1 M5 Awindow.onload=populate( f' d# l  N7 G$ {( G7 R: E

% j+ W5 L4 q5 L0 qfunction scrollmarquee(){
! z3 d3 d5 q/ W/ K8 B! L8 Q; sif (iedom){
2 B& C. @9 b! r/ @& qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 v3 r7 M' v: s4 I& L' w. t% Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 t6 T6 V1 Z2 l. `% e& I5 d! e
else. m- F" P; h4 H1 |  Y
cross_marquee.style.left=marqueewidth+8
" K  I. p8 I3 {
% V' Z0 @0 S: s+ `% F- N$ v8 N- X}
+ P. l) }1 n& Welse if (document.layers){* Y" v1 v9 r/ Y2 F4 K7 ?
if (ns_marquee.left>(actualwidth*(-1)+8))& z6 S. |! [  k
ns_marquee.left-=copyspeed8 T2 ~9 w) J' U
else
: u2 _6 S1 l/ A; a! l$ ins_marquee.left=marqueewidth+8  n4 n- k. K  [5 B4 [2 d( _& a( H. ?
}
4 m' M3 ?$ R* h& c, E  B}% i0 @" ^, b3 |- A' q

( @' v9 Z. p: a6 s' E9 Kif (iedom||document.layers){2 B: e9 k9 D' a5 M' V6 l
with (document){* B! A* N' L! l+ U0 U" V3 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ n& n7 D) `; ]& Dif (iedom){* E1 N, x6 W9 B# h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( n" b5 G$ @, _: l/ r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) C+ w8 E2 ~( m; `3 vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( K% B: V  t' P* f
write('</div>')
, v' M- ^) Q* O; x' K+ q}& V. C( @0 ]# Y" S3 I+ |
else if (document.layers){( {8 e& T% B7 q0 v$ z3 \2 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 o: e/ R3 P' @& c' w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 X* X5 {& ^/ {6 U* g
write('</ilayer>')
7 r9 s5 w) i! g+ M}2 b$ M+ z$ Q9 b' z  j; p* b
document.write('</td></table>')
$ Q* b  ?* K5 `}% Q, i* L0 C" }  D, T
}) W# n/ l# B5 P  F! ^  d
</script>

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