返回列表 发帖

网页之跑马灯文字特效

//修改宽度* \4 p- d4 V" s6 E' H/ v
var marqueewidth=300
  O) Q5 x* X" J2 J//高度0 J: z* [# N' C) O* l
var marqueeheight=25; M. S7 Q* d- j' B, H' r; o* l) J" Z
//速度(1-10)
) o; A. s# X0 W# U' U3 _var marqueespeed=3
& ?2 W) v/ j: s; o6 A//背景颜色. o' e' X/ J  `: ]
var marqueebgcolor="#FFFFFF"1 z$ |) t2 P9 S' W
//是否能暂停 (0=no. 1=yes)?
% X1 ~  D' w( v# t* Tvar pauseit=1
/ @( B2 K8 ^8 M; \: w: [- `8 ^+ H+ f3 m: j  Q
//修改显示内容7 T* v8 D/ |+ [' n) Q/ B: f$ l0 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 i3 M9 m% E  Q( C7 D
9 D3 V  |1 k1 y
* O- h$ f- v# f3 V////下面不需改变////////////
6 C7 ~1 J% y' h" z& Y0 o
  b3 n4 s0 ^4 t9 ?+ h, Rvar copyspeed=marqueespeed
4 c: D3 S* I5 g: I9 O4 d9 V1 `. M" Zvar pausespeed=(pauseit==0)? copyspeed: 0
- U1 b# }- u4 o6 Cvar iedom=document.all||document.getElementById7 T( c0 i# O* m$ k) Q
if (iedom)- Q/ ^" O3 w8 v7 Y8 p) o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 |0 W, p9 d+ \5 f$ U) Vvar actualwidth=''
) W1 y" a& S* d! \0 a; i/ jvar cross_marquee, ns_marquee
3 b0 B0 R# g6 G1 T  e/ A( ?% |" t) F0 @9 g" z( i
function populate(){
2 }/ z# s4 @2 y0 Dif (iedom){# X  Z5 R% D8 d' ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 H8 D7 k) k: ^* `9 O
cross_marquee.style.left=marqueewidth+8
% e5 B* a# H& k: @. l; hcross_marquee.innerHTML=marqueecontent- K! R& l1 F+ g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  t5 Z# H6 D; d  f( Q5 o
}8 Y( [8 j' g% y. K5 C$ k7 @* ]
else if (document.layers){
5 O( G% J. g' D$ a9 |- Z$ Nns_marquee=document.ns_marquee.document.ns_marquee21 {+ [% J4 F' q% f& K/ {
ns_marquee.left=marqueewidth+8
$ B  x3 Y' y+ ?8 Xns_marquee.document.write(marqueecontent)
7 [! T4 f  ~- _1 A: Q9 Xns_marquee.document.close()
# e4 ^2 ~) k' U# Y' Z+ yactualwidth=ns_marquee.document.width
% u) [9 ~/ k1 o4 ?: K* v}
! M5 C/ m# H5 F- f% ~lefttime=setInterval("scrollmarquee()",20)
  Q& \2 G' d1 H}! s# d6 }4 [/ @, V2 }
window.onload=populate% Q5 w# ~6 ]. v  u' c
; S7 o7 p4 b6 r. j; P: `0 t  S1 v
function scrollmarquee(){
6 x/ v- H0 |  u( n: h9 O  J2 }if (iedom){
/ r) L' [3 y/ x# O- ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 S( o( Y1 d8 Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 M% X! O: j" s* |. S1 k9 Z
else, y/ Z$ _% F' I) [5 r% d! p
cross_marquee.style.left=marqueewidth+8
) ]4 q  X( t. I5 Y. \
1 H5 U* Y& ^2 t- C6 C' \" |}
+ R/ ~- y2 b  }( kelse if (document.layers){
4 S2 L! V8 Q" `+ lif (ns_marquee.left>(actualwidth*(-1)+8))
. N6 ^  k' `1 v' @4 \2 Q) ]ns_marquee.left-=copyspeed
* K, s* s" z  l+ s" `( `' p; K, xelse8 g& \0 ~6 N. P. w/ ~
ns_marquee.left=marqueewidth+8& M. R3 r1 H  }" _6 V; Y# p0 R1 u
}
( X8 u0 z( q  [# P2 V5 ?/ S) `}
- w" P/ L0 \7 T% W3 ?" B! c# W$ a: G
if (iedom||document.layers){; z  F& }8 V% I4 a! s
with (document){; g. C5 y' P6 t& z' q* f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 ^4 H. [- }- B9 _" z' l6 n4 Dif (iedom){
$ O& G3 |- f3 }5 A- O6 d7 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 m. _8 @/ X2 ?/ c9 s2 G& bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 o4 y/ z7 [( f# y' E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ `& J, p( }* K* ?6 X
write('</div>')
9 g- x  k% ]4 Z8 H9 N. \}
. x3 c) G1 f, O8 |' R0 R, helse if (document.layers){5 Z+ n0 j' i3 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 E! L% T: b  X; u# b( ^9 ]" ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). i& T$ Z& x1 y4 F, s5 j3 X8 ~
write('</ilayer>'), O% ^1 ?: N8 j8 U3 {
}* q) u3 @6 H  w3 U2 n
document.write('</td></table>')1 T  x$ i& }# W% W0 n) X+ i2 ]
}
! j( ^/ I# ^" W; ^# a0 W  X}
0 ], R# |5 z4 J1 [</script>

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