返回列表 发帖

网页之跑马灯文字特效

//修改宽度; S7 O$ p8 f0 h& I. f
var marqueewidth=300: S7 J8 `3 {9 M
//高度
7 e% g- g1 C, Y+ \var marqueeheight=25
1 u" Y0 P/ ]3 E; @9 J/ N//速度(1-10)
2 X+ f7 N0 s+ lvar marqueespeed=3
8 P. R* t# p4 V2 C9 c! y2 P//背景颜色
  _$ j7 j- x# u3 Mvar marqueebgcolor="#FFFFFF"6 f* _. v. U2 T0 ^
//是否能暂停 (0=no. 1=yes)?8 ~7 }- q( k$ E$ _' F" I$ t
var pauseit=15 M0 z3 L: ^$ ]  ~2 {
* t4 h0 |% ?# ~; w
//修改显示内容
0 L- c. q/ X$ |5 `( o) Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( r- h* {4 q5 G8 P5 k
, c: ]/ j/ h6 L( k" J! R
; Q  U( e9 }; C  v! @////下面不需改变////////////
4 i/ ?# C" W0 }7 s; {9 f' @1 q: W3 z$ y5 y/ q8 ]  L* e1 `& X
var copyspeed=marqueespeed
1 b& H+ a/ k  w% G: b" Gvar pausespeed=(pauseit==0)? copyspeed: 0
/ J( L4 \$ I) Bvar iedom=document.all||document.getElementById. f6 E+ R, _( K% D0 s( F
if (iedom)
: @; F# p; k) A$ }! Y+ l0 {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! I4 P# E5 F1 N$ P0 `1 L) fvar actualwidth=''6 }  b9 M' F  f4 G) f; j7 _- b
var cross_marquee, ns_marquee- W' D+ g+ j5 Y- N/ u  q! G" q
" |, c$ k- b' @! j5 A9 K$ K
function populate(){7 ?, C6 d6 r1 ^# p$ n! C! @
if (iedom){
( j# _" J& \! w) T3 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) |% C/ X$ }/ {8 v) Y8 q- C8 V' Hcross_marquee.style.left=marqueewidth+8
; p8 q9 O8 ?5 ^( Q( x: Scross_marquee.innerHTML=marqueecontent, f6 S; J# H' ?; j& ~: c# q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' a9 {  y2 J! I0 D! L) u$ p- B
}
" K, w; A) d, L- U. }' e& `; Welse if (document.layers){' y1 v! q, v: Z
ns_marquee=document.ns_marquee.document.ns_marquee2, d6 T2 a6 p( p8 k
ns_marquee.left=marqueewidth+8. Y8 H+ Z- P6 O, C- c9 r
ns_marquee.document.write(marqueecontent)
) `( |6 s0 \5 g' d! q6 I  Y) ]ns_marquee.document.close()
5 @4 `0 I4 \0 ?$ v( U- x1 lactualwidth=ns_marquee.document.width- @! h9 ~# N2 p. e* U
}
, B3 f" s7 z! `" M6 h/ J$ ?lefttime=setInterval("scrollmarquee()",20)6 x. o$ f/ d/ Q
}( V- A# |3 }/ g( R; ]4 q
window.onload=populate/ J/ h$ _9 ~+ G5 j

0 E7 x7 O  g& L/ T4 Ofunction scrollmarquee(){
) I/ \- j1 _4 j$ v! gif (iedom){' N; s/ C: n4 \' g9 j* S1 m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 B5 P" c$ ?: ~! ]. [1 G1 ^' U! Qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 Y8 a  ]6 `" o$ {2 o. ~2 l
else" K0 a  X+ e/ D
cross_marquee.style.left=marqueewidth+8
& |; `' g/ t/ h1 f% x& P
; R5 g$ S% ]( z+ k; `5 L( \/ m}6 [3 e3 R/ {& z9 j& U
else if (document.layers){/ f, B. ^0 g4 ^+ d
if (ns_marquee.left>(actualwidth*(-1)+8))+ g: r( \( L' b, h4 F1 X: \7 m# g, ?
ns_marquee.left-=copyspeed
# h9 x1 o8 a$ t$ n" u4 `else$ T6 t. a5 K: E4 a; u& V
ns_marquee.left=marqueewidth+8
' \' F! @. [1 ^- u}
" U: }# M5 ]* |  A& l6 H% B; F& w}( Q# I/ _# t1 Z8 t  A3 V

" _; E  O' T/ X5 u3 r3 @/ pif (iedom||document.layers){
; B" m1 p/ ^4 f; Hwith (document){- G( D: d  c# U# M4 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 B' h  O0 b/ h9 lif (iedom){
# T1 d( O2 c2 a, ^* O$ i% bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  Z& C1 Z- D4 M! u) A2 R' mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. m# q- q8 R5 n7 A- uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 J- h( X  m! k& Q) D, e$ J0 X, e: jwrite('</div>')2 i8 q- o! D" ~
}+ T! I" Q  j) G% {! t* R, C
else if (document.layers){+ P' K" z4 K: b+ f/ W2 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): X0 z/ t- C" D6 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* \! M: I  {$ b% z) twrite('</ilayer>'). O) c2 ]( {# N# v% X
}
9 X5 [' \7 L3 Kdocument.write('</td></table>')
/ f* o% q+ f' Q3 O; o5 G}+ |+ f9 S: }5 U* u: v' x7 t( ^
}
- I% z2 m+ ~- u6 i% N- c5 s</script>

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