返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 W6 Y  r# k% ]
var marqueewidth=300
4 T3 V/ s2 h/ \8 y5 u//高度- j' p& f$ d$ E' x, U% I8 H* f( t% z
var marqueeheight=25) V5 v8 Y& O, h/ s  Y& K
//速度(1-10)6 d/ @% B# {( a4 o9 ^0 d0 P
var marqueespeed=3
' R% @( l& P& e* d- h- K- W0 X$ f5 U//背景颜色
  P/ u9 P+ o+ ]+ y+ O( dvar marqueebgcolor="#FFFFFF"
, f1 D5 @: e6 Y' C; c//是否能暂停 (0=no. 1=yes)?
" M% e5 g& ?) M9 G" f% \% F, m$ Y, Cvar pauseit=1
, L8 A; @' J* ^9 i4 X1 j# S' b1 J
# P/ p) r/ f# j1 a//修改显示内容
: C. }+ B7 \' x1 y% |( Q+ mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 f2 k- }/ y* j$ a0 B
. D$ ^/ q( G, M. V' d: k: c) G# R8 C* [7 V
////下面不需改变////////////8 g- p7 o1 f+ B3 d
( P! J% H* U. Q; I8 v  `; |: H
var copyspeed=marqueespeed3 E/ n* f, g6 ^3 I  L3 E/ t6 }
var pausespeed=(pauseit==0)? copyspeed: 0& h- k% V* b" o3 i9 u1 I5 a* k
var iedom=document.all||document.getElementById' n3 K* l2 k# w
if (iedom), v* ~, p, v8 s+ J. R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); ?) E% J! O4 \
var actualwidth=''( M; H, x  T, B" a/ K0 y
var cross_marquee, ns_marquee  c, N! a7 J/ X; E1 d" i

/ {; K/ j4 K2 u7 C9 Lfunction populate(){
, @& s+ D; z9 [- L; X" {0 X; I8 {9 D: Jif (iedom){
# a. _1 o" C: P- kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& D! w; l  ], L8 ?
cross_marquee.style.left=marqueewidth+8
" l/ W; ~  {# Pcross_marquee.innerHTML=marqueecontent
0 d2 e7 W- `; N% r" ]% k' M( Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: [/ R4 j* X8 e4 ~
}
6 M( E  B3 o$ oelse if (document.layers){* I# {! p# l1 N! b" P' M
ns_marquee=document.ns_marquee.document.ns_marquee2
; ^0 f8 p& x1 Y! ?ns_marquee.left=marqueewidth+8; u& s+ J( b/ F/ A
ns_marquee.document.write(marqueecontent)7 Y* E' D  M! U0 i
ns_marquee.document.close()
; Q* F4 t+ [6 v* J/ @actualwidth=ns_marquee.document.width
4 G" o1 z7 G. p$ H0 D5 ?}
% G3 O6 {9 K% `. zlefttime=setInterval("scrollmarquee()",20)  k+ M$ O6 i& u
}
* q* D  R) l0 L/ M6 N) U5 d+ |window.onload=populate
# w/ h) [9 p. C% ^  q2 X8 Z! t- z3 n! e
function scrollmarquee(){
7 j$ p5 X& _2 \7 i3 e# Jif (iedom){4 O7 K, D, g% ~% Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 \1 e4 W# ?7 T3 z# xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! _$ J5 D& ^2 _& ?* Y* P  e/ qelse
+ i' o" w5 s- A' F8 Lcross_marquee.style.left=marqueewidth+8
! c! Q9 T- h' b5 |6 J
5 i: v; M! a# d, }  o; W}1 v3 F1 y; Q/ s% p3 b$ `
else if (document.layers){
; ^+ ]3 S' |* ^; Wif (ns_marquee.left>(actualwidth*(-1)+8))
1 p. I7 j/ p6 [9 F. I! O6 {ns_marquee.left-=copyspeed: V7 @1 L; p( ]
else0 o: G+ u0 w) }  Q: b
ns_marquee.left=marqueewidth+8  B% P' M8 t& p  i* B2 Q9 x
}
# \: _6 c7 l, U! w, V8 s) ]}/ Z. t" _  |) Z& P

$ R# s, y2 L* oif (iedom||document.layers){
& M7 _& F& U1 O: M4 q8 t' {with (document){
+ z( k( t) L5 P! Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 C# r& ]+ F9 O* N0 bif (iedom){* h* Y  P0 {* d- F- v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' {4 ~5 r" ~6 ~9 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- Y' {5 e; @8 O( Q: R. [# n% @' e- s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) e2 L( M/ f2 D( o" Nwrite('</div>')
9 j8 P. X5 t. k3 t' Q2 `- s% \}) L$ O1 \2 I, z4 |
else if (document.layers){/ f) P5 Q7 O8 h# G  F0 K+ }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: k1 a& {4 t1 u+ L8 m% zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! D; F" d* U9 P& H5 r' @' V! j1 q- J
write('</ilayer>')( g8 f2 y" ^7 w
}
9 ~, m$ e/ H- u# }document.write('</td></table>')& N6 [# H( K8 ]; ?
}
3 w" Y9 }& H% m  }. }8 _}) e9 r6 C) J0 R! O) r
</script>

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