返回列表 发帖

网页之跑马灯文字特效

//修改宽度) m8 d( L  q! E: V( D8 u. A! d
var marqueewidth=300
) h/ {4 ?+ z0 w! V- }2 Q5 Y5 U//高度
6 O) z9 I  ?' E+ |! pvar marqueeheight=255 P/ {) i; i/ f' D; ]- z
//速度(1-10)
4 X  S* g; I# c" Avar marqueespeed=38 ?3 ]8 `( r# p0 K. G0 b
//背景颜色
' D( }9 M& H; R/ g, j% Lvar marqueebgcolor="#FFFFFF"( N8 l: n6 `' ~3 ]/ @7 y
//是否能暂停 (0=no. 1=yes)?/ a; `* B) r1 Y
var pauseit=1
+ ?' w! d( q: G! j0 J& D- @( g& z4 y9 x+ d2 Z; ~
//修改显示内容
( ~1 u* M% O) ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 q, B6 C5 J# s6 X9 e& K4 G0 s6 a
4 }# X% }9 e4 @1 ~& L
: |- g/ B6 h3 C" f( G////下面不需改变////////////
8 J8 d6 B- N5 F# i0 f( H* l  x
5 E( D9 E% q9 k, e$ M7 h3 j, p: Uvar copyspeed=marqueespeed
. {6 p( s. x* v4 j7 C& n# wvar pausespeed=(pauseit==0)? copyspeed: 03 a% y. K: t# `/ u2 V
var iedom=document.all||document.getElementById5 y, o4 u4 c- X
if (iedom)
  I( z0 ~/ \3 Q, v) Z, l4 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). b6 j1 f# w) ^1 P
var actualwidth=''4 Y: J# |; P. c
var cross_marquee, ns_marquee
& J. _% l( R8 I( I0 y3 a7 S- M  o0 s+ t3 V: m; r
function populate(){
  K! b* u" C- q2 M7 k- e% h; Iif (iedom){) F3 W3 R% K+ e& X5 {6 C0 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 D5 O0 @# z- ?6 p, X/ D) m. N
cross_marquee.style.left=marqueewidth+8- j$ U& s6 Q! }! U4 e+ r( x
cross_marquee.innerHTML=marqueecontent
' S8 D' A/ c1 ~- pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' P7 m9 y0 ?1 C6 ~% M}
0 q9 P2 L4 K; Ielse if (document.layers){
+ w3 w( }/ M2 m0 u7 z3 ]$ Vns_marquee=document.ns_marquee.document.ns_marquee2
" d4 m1 B5 R. G; I9 }1 E* Cns_marquee.left=marqueewidth+8
) c- v) W; ?% P" e- i- s0 ons_marquee.document.write(marqueecontent)
9 m6 J$ S, E( D5 E" y& Bns_marquee.document.close()# G3 Q7 k& W# V& s. E8 {( U' z
actualwidth=ns_marquee.document.width
$ \& g6 |  S$ O. ?1 G- L' T}
  x7 Y2 r5 t6 B  `' u) ^/ O  M9 elefttime=setInterval("scrollmarquee()",20)5 l6 d; a5 O: A% x
}
% J* Z2 R+ j8 M& a3 c3 M# Swindow.onload=populate
7 z9 [2 Y! Q7 T3 C& T" B9 p) P! ~( I) ]- J( H& {
function scrollmarquee(){
2 _1 U- G+ }" Y5 {( U. Rif (iedom){
( L+ F5 a- w' C/ D& S3 uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 G. k8 K# @1 p6 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; d% j! l1 i. Z7 }" a0 H' ^6 {else
2 [0 S6 ]; W+ \' Gcross_marquee.style.left=marqueewidth+8
& A$ ]8 q$ L) |+ Q
" }) v% Y  w# i2 O$ X4 d1 V}
0 l5 i. D" t/ V  @else if (document.layers){# p4 F6 F" ?8 M, v9 m
if (ns_marquee.left>(actualwidth*(-1)+8))
6 F# ^' W" `; ], `% s3 T/ C! G+ Mns_marquee.left-=copyspeed
2 X& |" L; r* o' Jelse/ D3 K" C0 I: d9 n
ns_marquee.left=marqueewidth+8
' Q' |/ V9 M3 _( q8 T) t}
. \- b# K- F8 I' }  E- ^}& {/ c% s3 S  l* w; F/ F' W
7 d: @2 Y1 R9 n
if (iedom||document.layers){0 H% a& V1 w! T& t- v9 V
with (document){
* W# _( O4 Z1 m* T' \6 L* J, r8 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: X5 M9 G# _* y6 Q  `if (iedom){
; Y0 A% H2 A7 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 B; p. O! s* E( f' ]. Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& F+ m$ G: a) S- R2 m7 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" o/ p' y# B; V  _! @write('</div>')
8 K+ H/ W3 s3 v' P}
. k7 h8 E( v% |( H4 {# ^else if (document.layers){7 f$ \& w% w, J/ O, b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& }  y! a1 D7 r9 C: Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 X  r& w+ T2 r, [0 ]  ~7 nwrite('</ilayer>')9 v5 e+ g9 V% B/ C0 y  y
}
$ E- a7 M, s5 o  |: ~; B, Xdocument.write('</td></table>')9 W# P' v/ v# E" A
}
$ u4 P# ^9 Y& n}
- N' Z- n" C' M  P+ R9 Y</script>

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