返回列表 发帖

网页之跑马灯文字特效

//修改宽度; r3 D" t, U3 S0 i- ]
var marqueewidth=3006 D/ Q9 {. x8 n  d0 H) K
//高度; u3 N! @; t" z1 E6 I
var marqueeheight=25
% F! _; d# X  _8 b//速度(1-10)- S1 I  a8 d5 C+ Z: [- A2 l
var marqueespeed=3. @* J0 K( P  u1 z. T
//背景颜色
' f6 d$ E3 j" ]) I' fvar marqueebgcolor="#FFFFFF"7 c4 k2 k" [( p+ x$ i, p
//是否能暂停 (0=no. 1=yes)?
. {# `6 Y6 B) Ivar pauseit=13 v- \$ w+ H. W. Q

7 y+ M. N% e* t" \//修改显示内容
0 s0 m7 l' o* w) hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 T% f/ l; ~4 E+ W2 p! c' v8 y

7 l& `) {/ ]1 i1 d/ z7 p- s/ w0 W4 M/ q& e7 K
////下面不需改变////////////: u7 q' K2 g, K9 j& Q& q7 Y

- {. P' e; f; G. k; Dvar copyspeed=marqueespeed
' x  D2 L: o" w% M+ Dvar pausespeed=(pauseit==0)? copyspeed: 0
& J; M  k, k' \9 q; f; a2 vvar iedom=document.all||document.getElementById
; {* R* E  ~) A5 k) ?5 V0 U# Zif (iedom)+ L/ F- W* s7 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 r  x$ S4 A" E" l# \
var actualwidth=''5 K: w! c1 U! M; z
var cross_marquee, ns_marquee
# L' Q" M8 Y2 @+ G; u( }" _: m9 ]+ `) d/ s9 l* I/ O# D, N
function populate(){
0 a5 N: s2 E. H1 M8 y. L* ]+ Fif (iedom){
' `: c, L; V/ N- I" `" ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# R8 u9 r* G6 S# tcross_marquee.style.left=marqueewidth+85 G; g+ I) @. [- T9 W1 l+ t
cross_marquee.innerHTML=marqueecontent
, s, y- W$ m1 o3 C) y4 ~- D" ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% m! q( x5 A' p  R) l; Z}
5 X. g6 c3 l' G. \) Kelse if (document.layers){
, N- D7 q" n7 ~  t  b! k6 Sns_marquee=document.ns_marquee.document.ns_marquee2
& o: G3 @+ R2 ^6 E/ Z  {ns_marquee.left=marqueewidth+8; N: a- @  h' R4 F- V
ns_marquee.document.write(marqueecontent)
! u* }3 G3 u# M" V2 ^$ Tns_marquee.document.close()8 A; e3 L3 o  k. N4 u# ^& }
actualwidth=ns_marquee.document.width1 X8 k1 \5 i( G' g8 W" o. y# A
}& P) Y  Z4 N, _1 l' p5 X
lefttime=setInterval("scrollmarquee()",20)
5 O4 \/ d. y8 t; g/ n}
0 _$ p1 Q& y7 F* t4 {! |window.onload=populate6 r) T& {1 v5 k
& G- f0 P( r3 f8 a
function scrollmarquee(){
5 `) I' z: J# o  K" Gif (iedom){3 K9 [2 F4 u" E* c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 E+ B; s% Y8 m# Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 W! c- J2 I4 T' J8 _else/ q2 B, Q1 Z  ?* ^& H6 K: R
cross_marquee.style.left=marqueewidth+8
& z5 ~; ^4 s' h/ Z* L0 n, c5 t. ]/ {1 K6 v
}  ~: r9 c5 A3 b, i+ q7 z
else if (document.layers){
( _0 i9 x' `" [if (ns_marquee.left>(actualwidth*(-1)+8))4 B1 D/ {! h' E$ v! d3 P% p& w
ns_marquee.left-=copyspeed
! d/ Q% ?! k) u3 m* v, @3 Pelse1 ]. i# i' R, {
ns_marquee.left=marqueewidth+8
* w2 f/ d; U2 m9 @}! x- r* T* ~$ ]! g
}" p( F$ d: j9 m' ~

! \3 j3 q% ]. g7 eif (iedom||document.layers){4 ]( f. o8 a$ }0 M% X" e, ^
with (document){
# Z3 ]4 c& K$ c& M& ]. cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). k$ O) |: m9 k
if (iedom){
+ ?5 x6 v% b# a& F+ mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 O/ K2 g0 F7 D9 N1 ]. r& iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) w( [# m" i( |6 I' bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! I& J- D9 R3 H5 R* K% t9 ?& X/ uwrite('</div>')' ~8 j: S* J* v; \$ c! X! o  u4 ^
}
5 G  e9 ^( ~- Telse if (document.layers){- n# ^0 t" B1 K# r+ }" H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  o+ Y) i+ e, a4 m0 nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% u4 t# e' }$ I" Q" n" q3 q
write('</ilayer>')
& l- ?# ~5 Z2 d' _' \  S; J}! r1 s  d" z5 A9 `
document.write('</td></table>')
1 @( v3 @, n2 b}# @. A$ V' c+ I! Q  w2 `
}+ q+ V' g" \& z' I. t' H. |
</script>

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