返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& ?* u. X( \% q3 Jvar marqueewidth=300
- Q7 c7 i* H5 ]( H1 f% L//高度7 p0 Z! d+ L( j! d" j: {3 v2 f
var marqueeheight=25* N7 l* g& B' g( \. n% D9 k% Q
//速度(1-10)3 u) \! h% v4 ^& c
var marqueespeed=3
" D- ~" q) M0 T//背景颜色( d- d- C$ V$ N2 N: Z# @
var marqueebgcolor="#FFFFFF"" [3 H- t$ i' _! H* }5 S6 }
//是否能暂停 (0=no. 1=yes)?5 w# ~2 {* F' b8 [9 O* ]) `
var pauseit=1/ U% _; Z, y! f) e* C

9 q& u; D- D6 X$ [+ G# J//修改显示内容
) a2 C$ g6 \6 m5 U! C- Z/ q0 evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 q' j& `0 Y& f8 t0 Y" Z
4 Q% a0 g! [) `! k3 i1 Z
" E  h! K% U7 x, D* h, W0 B3 \, u
////下面不需改变////////////
6 ?0 ]9 X# u" s. p) R; C9 {; v  {8 l# O! c
var copyspeed=marqueespeed
: O: }( b' a/ R; y& M/ }8 [var pausespeed=(pauseit==0)? copyspeed: 0  ], c; w. j3 z) P( |& u
var iedom=document.all||document.getElementById
* D9 \7 ?4 Q' q+ D# `if (iedom)
$ z% G8 H" S4 T7 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% Y* q2 Y& [0 e7 U. Tvar actualwidth=''
; a( G0 ?4 Y3 C+ \4 q9 p5 ]# U3 nvar cross_marquee, ns_marquee3 f0 H# e3 y5 c' j6 k* v1 ~

  C' w( g8 N0 v6 _( N6 ?function populate(){$ x2 r) _# g* p' o) c
if (iedom){! q0 K4 O7 c) ]) {: l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ @: U0 |. U/ h) t
cross_marquee.style.left=marqueewidth+8
& x* j# E: t1 d6 g' scross_marquee.innerHTML=marqueecontent
2 Z8 F7 i/ {0 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 I/ s) ^# a  B4 v, `}) m# H7 a% ], A% Q  B
else if (document.layers){, W+ Z' K1 O$ g0 B% `* ~. T
ns_marquee=document.ns_marquee.document.ns_marquee2  t; m* y+ `4 w5 J
ns_marquee.left=marqueewidth+8& Z! m0 \: ]3 X/ `
ns_marquee.document.write(marqueecontent)
- p5 |/ `' O- r& ?ns_marquee.document.close()
! D, x% b; F# S* K, |actualwidth=ns_marquee.document.width
3 o+ u/ `* Z/ i+ z3 q( @( c}
8 B) T9 G* _5 E8 V7 i& @lefttime=setInterval("scrollmarquee()",20)
; a7 r, b; O5 Q/ w- }1 U' ?}( t1 t+ `3 m$ e9 g6 p
window.onload=populate
1 e9 g$ `* M/ W% C4 N5 R8 G! E. X9 Y$ b2 R! s) y; V+ N
function scrollmarquee(){' z! U7 `/ g4 U) a+ |7 H0 l
if (iedom){; Y; s7 g+ i& p  _* q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 q+ ~- ~5 B* K& u, g( {+ d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 ^5 X0 T6 E- }# ^' W, V; x9 x2 W
else. [; z0 \! _. @0 |0 O5 f5 O* O
cross_marquee.style.left=marqueewidth+8
) L. ^% W6 S: J; F% g- G$ O) j% u: x6 u
}
. R$ ]) i$ X' n) [4 t% ^% Ielse if (document.layers){
9 k+ F- `2 ^" u; }( ]if (ns_marquee.left>(actualwidth*(-1)+8))
# J4 G0 U9 ?5 N6 ~" z  w6 D: Xns_marquee.left-=copyspeed% F8 o$ J; [- z9 ~6 j, s7 W
else
( h, a3 ]8 j5 j) tns_marquee.left=marqueewidth+8
( e% H) \  R5 m2 k}) G; u5 R( b. |) G9 t
}
8 ?7 z- V& o) i; D" y( V! y9 k1 ?& K+ b& d+ Y2 p4 k
if (iedom||document.layers){5 o4 Y$ b/ ?5 o2 @% a
with (document){
. j- O- D9 j- a! w" Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 H. `. |1 \) f. nif (iedom){
+ e: v7 H8 X3 R/ g% ?5 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 y- q" p2 }% F" x# d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 T0 F$ v8 _1 F0 A) _& ]6 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- v" `* K9 c! Q4 m* r) Ywrite('</div>')+ o3 q6 R/ r4 {8 V
}
8 v: g' D) E' F/ ~$ O/ v7 v5 Belse if (document.layers){$ A' V& W9 d1 ?4 c) S; h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# ?7 t! }' f8 h) t) _- _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): ~3 G' L  D. z9 K
write('</ilayer>')" F* e* _3 q# s+ o' z# G
}
/ |% ~4 X! F) N- @document.write('</td></table>')7 k' N4 ~! p2 C" p9 `7 j
}5 l' T/ v1 ^+ i; y
}0 b8 F4 A' f6 g* f
</script>

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