返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 ]4 R* F! T4 Q, O
var marqueewidth=300
+ @2 S& l3 D; Z" e- j//高度1 s3 J0 J" M7 l4 r' _$ z! F
var marqueeheight=25
1 M2 v" T, y4 V//速度(1-10)7 k( v  H1 c' f7 p- b; ?. L
var marqueespeed=31 j. q% G& U# ]* R( R
//背景颜色
2 M9 q' n, S' U8 O. a5 G7 A/ U: zvar marqueebgcolor="#FFFFFF"/ r0 `2 x: S/ j$ Z& C8 H
//是否能暂停 (0=no. 1=yes)?) X0 ~) V! J" p: i% n& e
var pauseit=1) N% r- Y* j0 \1 U

" a3 p6 l9 I, ^//修改显示内容  A6 ]% L- ?5 y% Z1 k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) q& e6 e( X4 R( Y
$ S7 O# b" v$ s  |$ m* s5 ^* `. {0 U9 ^
////下面不需改变////////////
2 y6 o: B' f+ c5 ~  j& o$ G6 l$ f3 ~% Z: d! k  y2 h
var copyspeed=marqueespeed# {; x% X6 u5 Y* z
var pausespeed=(pauseit==0)? copyspeed: 0
" h# l* N$ B8 Hvar iedom=document.all||document.getElementById$ @! F8 J" ?0 }" ?$ O
if (iedom)
0 ?. O; Q% B) ?+ Y$ D3 ?8 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 U' C1 ~$ a& w  a
var actualwidth=''
* p4 A) f" V) R: ~, w9 J7 H: Rvar cross_marquee, ns_marquee
$ q1 R. e+ j+ e# }* V5 m" O1 T; N4 r7 ^+ f0 d
function populate(){; ~7 i8 G7 F6 w. p
if (iedom){7 Z8 J& n% l8 M6 k6 A% l8 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! H7 \4 E5 g. m3 w
cross_marquee.style.left=marqueewidth+8! R/ [; X2 k2 l' c( N! g- x6 Z( Z) u
cross_marquee.innerHTML=marqueecontent7 e! F% P( u" O4 ?$ A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ A) m* H* T# S% M& r/ Q1 t! S}
7 A: W3 K7 N  jelse if (document.layers){6 u9 X# O, p8 v0 l9 |( G
ns_marquee=document.ns_marquee.document.ns_marquee2
$ N1 p; m3 e+ b' \ns_marquee.left=marqueewidth+8: z3 y4 T: g% Y" w; o* I8 U
ns_marquee.document.write(marqueecontent)0 [  P, ]1 G* @6 k' K
ns_marquee.document.close()* ]$ B5 ]) R5 L+ T( O: \
actualwidth=ns_marquee.document.width
- F5 \% \/ I3 s' p4 q' X1 i}4 n4 H# H' n. w7 x; F
lefttime=setInterval("scrollmarquee()",20)
* ?7 S. f' s' H2 G' d4 u. f6 ~}/ p/ {5 ~4 m  c
window.onload=populate
9 P/ m& U7 V* g+ |) u2 [$ ~% c9 x, Z
function scrollmarquee(){0 I' B- G# |' `/ ?
if (iedom){' p+ h- ?4 L, j: A  S- H) Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ ~* s; W+ J. N# pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, k3 f* w' p1 F7 s9 P
else: `. ]" F; U9 n( J4 t7 ]
cross_marquee.style.left=marqueewidth+8
6 M  h6 [9 E9 ?% M+ _  Y4 F1 n/ j6 P
}
3 a5 R0 H/ v" }2 C. selse if (document.layers){' ?8 ?! u# F7 |% b; \
if (ns_marquee.left>(actualwidth*(-1)+8))8 W5 t7 J) v- P- B# e
ns_marquee.left-=copyspeed2 V9 o* [% |* V4 y- N- i
else
; L: l+ Z- N  T$ q( |( N% P) rns_marquee.left=marqueewidth+8
; `- G- A7 a- J! S0 A- c& a}
5 E2 t. o. j; S1 E/ ]- ?}
7 Z5 F# d' G. _" c2 ?3 y0 [1 v
  q( f5 ], ~3 P4 W9 b: uif (iedom||document.layers){
& [" A; W( V5 u% j$ L2 p3 o9 jwith (document){
, L1 J1 f  p' P- z8 A7 {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& }1 L1 g6 G" J; G4 yif (iedom){
4 d1 `0 }* ]  O5 M% _4 ~# Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& l4 S- A: T8 x1 I8 C  K! t" E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 ^% j0 a( g# nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* A0 d/ _! k7 `. q( F" Uwrite('</div>')/ n- C- P4 @! {& m
}, W/ L# V, E1 l) X3 P* u
else if (document.layers){9 E/ m2 S. N! I5 I' a/ Y8 Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 p% @% l( {8 Q' p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ |% Y2 J$ N8 O: _. Z5 ~
write('</ilayer>')$ T, K1 s2 L$ u, i1 j
}
+ M3 g! G( w/ x, ndocument.write('</td></table>')
5 A0 s) p) e- Q6 C0 N}# N8 U2 @6 ]6 @4 L0 I% C7 F
}; j7 F/ Q1 c" K& o; F
</script>

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