返回列表 发帖

网页之跑马灯文字特效

//修改宽度, J* A2 ^, C5 b3 x
var marqueewidth=300* u7 [. p7 ], y1 [; B' @2 p
//高度7 Z4 t: G- {' V1 f
var marqueeheight=25* z1 S( l! r. q( s2 Q! H
//速度(1-10)
! h1 n" D. I* D5 ?var marqueespeed=3
  Q8 r% O% \/ V; [. @//背景颜色
! e+ s+ I- k# q6 c- T. bvar marqueebgcolor="#FFFFFF"+ E1 @( d; n. R1 W, |
//是否能暂停 (0=no. 1=yes)?
# Y" B; g- i; a* h, A+ b( evar pauseit=15 K7 w$ d4 L. ~6 C0 v
0 u' ^0 W' `: P4 N
//修改显示内容
1 S' {$ g) J- ?+ ]( Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': |8 |) X1 u4 @0 H2 u& r/ V
  y% q1 O2 N8 R0 f8 D
7 i- l1 c9 {) }4 |6 v
////下面不需改变////////////9 w  M- r# e+ H* v# m

0 O5 N+ @: I& R; L, X; \var copyspeed=marqueespeed
( s7 _4 ~/ Q  t. D$ C8 e" s& qvar pausespeed=(pauseit==0)? copyspeed: 0
, X; r- _; ]% }" qvar iedom=document.all||document.getElementById( a1 S! l0 E) y  V  \0 ]
if (iedom), H" n# S' P/ }9 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- r9 W( y4 j/ `  Kvar actualwidth=''- z4 u) b5 c6 {2 X
var cross_marquee, ns_marquee
3 ~9 O! ^" x( E; y2 \8 s( L) x
2 ]1 i6 y. Z: u0 Zfunction populate(){
, i( ?5 t0 t+ H5 t- eif (iedom){
3 j& h7 A: q! |9 }$ w4 A2 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 Y! t% @9 B: ^; a( B/ |0 q  R* wcross_marquee.style.left=marqueewidth+8
0 G; @* a" q- ]% _2 Q/ r$ `cross_marquee.innerHTML=marqueecontent1 r" ^' {' _; N$ l$ q1 F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 U- W5 ~8 Y4 a0 ^) L  u
}
+ X. O( g3 L2 O9 @$ T8 x4 nelse if (document.layers){+ ^0 S( P, I5 D, W! J* r
ns_marquee=document.ns_marquee.document.ns_marquee2
* h, k. ~1 e7 e' ?% t2 lns_marquee.left=marqueewidth+8
& j' y- J3 t# ~ns_marquee.document.write(marqueecontent)! L7 e, o( E  R7 l8 R2 o
ns_marquee.document.close()$ I+ C2 ^9 x3 t: ~6 U2 m& O! I; t) T
actualwidth=ns_marquee.document.width* `4 ]! O4 J  ]2 ~0 U
}( e! Q( [3 [$ N0 ~5 B5 U
lefttime=setInterval("scrollmarquee()",20); z; {+ T; b& r, s3 n9 `
}
$ Q$ Z- ?; e5 ]( F% U# @window.onload=populate
, [% g4 i, ^3 ^- m- x; @3 X& z% |3 b3 r* t
function scrollmarquee(){7 a' s. q( o2 S# s" |2 n
if (iedom){; h7 c( Q1 g1 A1 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 r. ~/ y$ g. f  h6 u( S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* Y" |% d5 c  m9 Felse4 y/ ^/ r' Q! B; c% f
cross_marquee.style.left=marqueewidth+8
/ g1 K1 `! R6 u! F) p/ r' z' G+ \2 z& x& h! \. Z
}
) Q* f* A0 s+ a2 Y: D. ^else if (document.layers){6 s6 K  f' Q) I! V; u
if (ns_marquee.left>(actualwidth*(-1)+8))8 X  S8 S0 Z2 b  [# |2 ]0 K9 w7 P
ns_marquee.left-=copyspeed
9 Y0 e, _4 u" X# N$ x' H$ p: [1 uelse! d$ i) w8 t& p  z3 J# C
ns_marquee.left=marqueewidth+8
. B/ F# S% `; |4 @: `8 J: A( `}5 @" P: Y( y6 E6 Y+ o5 o9 m
}( _3 `3 q' d2 K! F8 L0 W8 C4 D
5 j& {; o; f4 t$ I' T
if (iedom||document.layers){8 p' f9 t" T. z8 Q6 f3 R$ W
with (document){1 c7 H  {1 {6 y- p4 b" S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ @* {8 e7 C) g' Zif (iedom){
  T  T; K2 k% j) U# ~! ^+ owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( y1 t7 k/ B. j' k7 @9 wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* O, l0 `4 t4 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 _& y7 Z% x% v7 j/ F9 M( ~9 S: M
write('</div>')
" E0 V8 }2 ~3 z9 p+ @0 _}) [; K- f6 L9 k) \7 A
else if (document.layers){' [2 Z3 Y. ?6 _% N1 |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# @4 j, J- V: h" M& x0 r) ^" t. I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& N7 M: d. N2 Q! xwrite('</ilayer>')# y7 ]" s6 n$ t
}
( u% _& `* M# Idocument.write('</td></table>')
  V. C; l" {; @8 L1 O8 P}
4 m$ l9 ^  `, Y, g}# o" C# a5 k: {! @" Q8 H! y
</script>

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