返回列表 发帖

网页之跑马灯文字特效

//修改宽度) \/ }5 k5 S; ]( H  u, Q) u
var marqueewidth=300
5 ?" a  E9 b. J& ^  Q, D//高度
6 V' s+ C1 C: ~, Q5 d( k) Vvar marqueeheight=25: U. d- Y8 b& b4 u/ Z
//速度(1-10)
# d* k: n# T0 Q3 Xvar marqueespeed=3
& {5 N* X& I/ l//背景颜色, q2 x5 C$ e1 G& M* A
var marqueebgcolor="#FFFFFF"
0 [. ~5 ^/ W9 Y- M$ z# X  t//是否能暂停 (0=no. 1=yes)?9 o" i, Y* U) H0 j
var pauseit=1
0 c) j$ R; n4 o' s) `, {" P/ A  l4 m% v" t5 d- `7 s! v$ L
//修改显示内容
! K$ d3 O3 J) Z! Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& O" Q" m) H- W: r9 f- f4 \( p' T

; W$ ?4 V# n8 p) p; o/ u////下面不需改变////////////
7 L2 i/ j! d  r- V$ ^& ]  a
2 l5 y8 {' `" g1 b* ?# evar copyspeed=marqueespeed( q4 [, g$ k/ r8 @5 \8 G
var pausespeed=(pauseit==0)? copyspeed: 0$ c* t$ x3 e/ i
var iedom=document.all||document.getElementById* A7 {: j2 v5 s  G% r: n+ r8 O
if (iedom)
+ N5 F& F. j9 y  [  a3 Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* b2 e( M1 s& \3 cvar actualwidth=''
. b5 U/ L0 b4 b* Z9 g) N  N  Svar cross_marquee, ns_marquee
: `8 N- @2 H& }
& L& y% q' Q3 }1 |/ _1 S2 ~& {function populate(){& O& M' S" \3 i& m
if (iedom){, D* g0 M: T8 R, m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' ?- q! y6 Z1 J
cross_marquee.style.left=marqueewidth+84 A; o8 A0 L. @  h! k' Z% C, t4 J
cross_marquee.innerHTML=marqueecontent
/ `, @" H: J/ v6 l! y3 _9 ^/ f2 {8 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. q' U' u, A; y" E; l. o}, ?5 K& L, t5 |) ^
else if (document.layers){9 \+ x- z, }- S& J5 e' E
ns_marquee=document.ns_marquee.document.ns_marquee2! G1 Q% a$ K$ I0 ?5 \6 I/ O+ {5 z$ F! r& }
ns_marquee.left=marqueewidth+8
5 e; C$ m0 \( c) zns_marquee.document.write(marqueecontent)' u. q7 B, K& b' a) w
ns_marquee.document.close()9 A4 B# v9 Q9 B6 ~  Y$ q% y0 F) z
actualwidth=ns_marquee.document.width: c7 A- C# U& c! }5 H
}
/ V7 y; o- v- C5 h: h0 r9 f' }lefttime=setInterval("scrollmarquee()",20)
( L$ W  [( o! {9 x}
! m1 [& x# s8 t, ^8 y% I" Iwindow.onload=populate
. `2 w8 [" B& j/ a3 V( V# [0 `% Z
function scrollmarquee(){
8 W0 x' T# ~5 D6 D: U. U7 rif (iedom){6 I- N  d" P5 x) i8 V7 ?9 f4 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; L& U! w* {" [/ o. ^$ n) R) lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# D$ D) t1 Z! O% w) J$ B+ x9 j
else
7 v& O# @9 o7 o* d, S" ycross_marquee.style.left=marqueewidth+8
6 V2 T  ]4 t6 Z* y& R1 y7 ?# D
% \+ m& u1 [# N8 n5 J! t% K* ^$ ^}
, k: z4 @3 T9 q" f6 s: @else if (document.layers){
! E5 y& ?# l) {- v; G% Kif (ns_marquee.left>(actualwidth*(-1)+8))8 L$ G8 Q' ?4 K! \7 K' }  V" d
ns_marquee.left-=copyspeed/ _4 h- }# D4 h% c1 a9 Y) W% W% Q
else# [2 [' G" f$ [! E9 q2 z1 e
ns_marquee.left=marqueewidth+8
8 g6 V$ |0 b7 F, I* g; q. i}+ _, [3 m0 v9 o6 L
}# @8 y0 i* f6 P: ]

! P  R! K) M7 K3 _1 l9 Cif (iedom||document.layers){
, j) A: v; D; {, \; J9 j# f, Dwith (document){
9 u' p4 P* U( o3 u% Q1 J, Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. b5 O5 r# t0 f6 R9 c% Bif (iedom){8 s7 E" x; L1 |2 f! _3 j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 `% h( f; o4 f0 X  m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ p) {5 W8 O7 x9 iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) u- }! `% v8 Gwrite('</div>')
' L& x  K- m; t2 m' i& m3 l7 j$ \}
, T/ t/ R/ r* H6 u% L: eelse if (document.layers){' v3 N+ X$ O$ d- i+ C, p( B7 g& C( i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! g) r2 j4 j. n3 P4 @- Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  Z# [3 _' q  i2 z0 M9 Iwrite('</ilayer>')4 N6 @1 w( P4 H2 Y
}
: s4 p) w8 A# |$ ]" ^, wdocument.write('</td></table>')' D2 R2 v# @/ h' O& Q
}. z0 l7 f+ l/ q
}
" J: ]; z$ F0 t5 _$ d# x7 \5 ?</script>

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