返回列表 发帖

网页之跑马灯文字特效

//修改宽度: y5 z* c% a& }6 h/ Z
var marqueewidth=300
  T- h5 d) |* ]0 o//高度
8 x/ H4 P+ h  t7 l5 N/ gvar marqueeheight=25
# e9 s& K5 r8 z. i//速度(1-10)  y& u( ?  e0 t$ Q
var marqueespeed=3
  z' n7 i, A  G8 l  J7 \//背景颜色
/ e9 t$ K0 ]% Zvar marqueebgcolor="#FFFFFF"% ^0 b3 a* R1 \8 W8 W2 `
//是否能暂停 (0=no. 1=yes)?2 c& Q: J1 N3 u8 s
var pauseit=1' h$ ~2 J8 t4 s
! g, W' i  c  s8 T2 m8 e7 O# M
//修改显示内容
& u+ g8 q. c! }7 Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" M4 h! G( ?# h

/ L- i3 T# o3 P; S* n  ~8 C: P6 _3 o, O* R
////下面不需改变////////////+ p7 n4 \) G/ p$ a( g

& J- y' Q5 d$ Y, q2 a6 N1 ovar copyspeed=marqueespeed
; L6 _6 D* z, E: C2 o7 W8 V) j; Avar pausespeed=(pauseit==0)? copyspeed: 03 L9 O3 w/ c' ?) E$ {* c
var iedom=document.all||document.getElementById2 y) B- o0 z  M
if (iedom)6 D5 \! E  j: {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 e0 J! f# A2 Z' B* B! uvar actualwidth=''9 k  D2 Q7 Q7 V8 M' n9 V" k6 B
var cross_marquee, ns_marquee
1 G. N, j: k% a4 M4 K, A
7 X) |: Y+ K1 |% F! Y) ~function populate(){  `) x* d) e. ^% m; {9 s
if (iedom){: @, t$ @/ Q1 o0 {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ g# C4 {5 z8 v, p8 E7 i! M
cross_marquee.style.left=marqueewidth+8
+ o& K' t& e; N: ^: Y+ N' W( k) Bcross_marquee.innerHTML=marqueecontent
) B# }% @3 w* J9 {* @8 J( S5 k0 w% ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 }, M+ D- `/ X" N
}
9 L. F. O, T4 _; w8 x1 \+ Helse if (document.layers){& O% d/ x6 f/ t; v1 Z9 B5 Y8 g/ M
ns_marquee=document.ns_marquee.document.ns_marquee2, L) d. X6 D4 I$ Q0 x8 V0 L  q
ns_marquee.left=marqueewidth+8- d" D, b- Q8 _- S# f" i
ns_marquee.document.write(marqueecontent). C; R. N$ Q4 _7 s
ns_marquee.document.close()
, F5 O% m  D1 }' h* o" p  W% v7 ]actualwidth=ns_marquee.document.width
: g- A; Z: L, Y- d  ^}
; M: C2 Z; V( j( B$ Mlefttime=setInterval("scrollmarquee()",20)
+ D+ y  T9 q! u# l7 X6 c/ b}
4 I, {! [% Y% j% T& l: g% ?0 Rwindow.onload=populate3 W+ E) S  O' r+ l; t' D
  [; R0 y, F. G, w# m  U
function scrollmarquee(){% N" C- ^5 {% I. P; {# ?
if (iedom){! x' A) p  t" f4 H! ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). `! X7 C; r" E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, Q. K! a% w- T) @4 i) M
else2 T( e2 b# u+ I* e8 r& H7 ?6 h
cross_marquee.style.left=marqueewidth+8. X+ ~) h7 R- w

* p  q7 [8 g5 r}
+ x" }/ |2 t! r9 xelse if (document.layers){
$ n5 I4 \0 z/ o5 H/ _. B2 Gif (ns_marquee.left>(actualwidth*(-1)+8))3 F+ s9 A" r% O
ns_marquee.left-=copyspeed
4 U5 F* G, L3 w4 y0 P5 pelse0 a$ x( l4 d: V$ J% r  ~
ns_marquee.left=marqueewidth+8: ^5 p0 g5 l' F4 w
}
# c0 h/ G7 _  [. o# g}# w4 y  \0 v) ^1 Y( q$ X

& f, m- |/ {. ~- L) uif (iedom||document.layers){
) K' ^3 ?2 Q) wwith (document){! Z4 v- p, }. \7 O5 |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). F, r) f$ U4 i! x
if (iedom){' k! b" r$ H' m* \( h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ R7 V3 y6 E% W0 U( a- P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. Q3 i/ @9 A+ c# l! S. @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 q* L# A5 D4 A4 x" q* Ewrite('</div>')
( H+ r- \2 F5 T- \5 H}6 i5 @* n) d" U7 n+ p, Y
else if (document.layers){$ \1 Q2 O) ]" K3 T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ P  h$ r6 M( X( S/ I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 H3 ~$ i- o; D/ T
write('</ilayer>')
% y( S/ a& m9 \- p* J% q7 [}7 ^" ~9 E3 N3 b8 U4 g* E! j
document.write('</td></table>')7 H* u; ]* Q- c  _# Y( N) S
}
, n5 U" K- M6 C}4 s4 k; o4 J; ~3 w. R+ B/ ]
</script>

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