返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ c1 m# n. ~* `' G3 [" ]; X  zvar marqueewidth=300
+ ?0 {" C  r/ K. H//高度
8 d2 @$ ]8 |. d9 C( jvar marqueeheight=25' w4 R  X6 {1 @
//速度(1-10): {3 w/ J5 t8 L- z% ^
var marqueespeed=31 A' ]( _: x8 |) a% E0 q8 _
//背景颜色
7 x* h% d+ T' u* d7 [* p8 l( Avar marqueebgcolor="#FFFFFF"# t1 X- ~. f" L
//是否能暂停 (0=no. 1=yes)?( r8 W9 u; }) p- _, D
var pauseit=1% [  Y2 ?, \! w1 @7 N' q2 l

8 k5 W% _7 i/ i+ m" m//修改显示内容2 I7 t8 P5 l( ^2 s- v1 G1 q- d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 f' t! r1 h7 L  }9 G( w
5 W7 l/ d7 k1 D6 @/ ?! x6 B, V: }2 W0 V& L6 c# Y
////下面不需改变////////////
8 q9 i# l+ P3 `$ |- {5 }+ J$ U7 H2 J; P
var copyspeed=marqueespeed& L. e( ^# n: N( z5 I
var pausespeed=(pauseit==0)? copyspeed: 0
. e; i+ j( t3 s( Fvar iedom=document.all||document.getElementById$ N$ x- V7 u  b- ]
if (iedom)0 ~4 r$ `' t) Y3 z% ?5 _" x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); y8 |. u; T7 P( |
var actualwidth=''" Z6 m. l( C2 |2 C$ ~8 c: W
var cross_marquee, ns_marquee
+ X8 s  |0 t- X% I7 o* b6 `# i# q" L) p
function populate(){2 ]* z! f) K2 `# H  F
if (iedom){! l/ c& m1 j) ?4 x% ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, _" R6 r$ X/ P: |  dcross_marquee.style.left=marqueewidth+8; E  b9 s% Z( D' G! W2 g! L
cross_marquee.innerHTML=marqueecontent; I  B$ S6 k2 l( K- h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  l4 O5 B2 q  B+ U( \8 T+ C: h
}
: p4 a7 ]* o) a1 n2 \# j1 ~else if (document.layers){! T3 N. e3 e: o
ns_marquee=document.ns_marquee.document.ns_marquee2* i* R, d) j# a' I
ns_marquee.left=marqueewidth+8
$ H4 I, i- K6 s! ]6 L* ~ns_marquee.document.write(marqueecontent), L0 ~" U: c' _9 E& u# m6 u
ns_marquee.document.close()
$ h5 J& F, J  d5 j" v  E1 aactualwidth=ns_marquee.document.width0 o) i' ]6 ^# Y% D  i
}
4 S' K( I/ q. f5 v0 nlefttime=setInterval("scrollmarquee()",20)+ Z- }" D+ U6 v* D
}
, P* W/ \1 ?# A4 m5 w4 ?window.onload=populate6 o, J7 P/ y2 W; j

4 a& w* {  d4 u- c1 Gfunction scrollmarquee(){
1 k1 n' ?& a0 n1 [; Gif (iedom){
7 b3 h8 R5 r# W. B: rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  I* r1 C, ~5 }- s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 h# H. N4 L$ f! C3 Y9 w1 M- k  Welse& \' }, x0 m- j* L; e# b2 L
cross_marquee.style.left=marqueewidth+86 Y, Q# y. J& q! `+ k8 M7 g

9 z3 y$ y, k% H4 @# j; N2 U' a. D}' k$ F+ Y3 J8 \8 X) w2 n* Y
else if (document.layers){( ]0 R: Y" y5 T+ p4 W7 i
if (ns_marquee.left>(actualwidth*(-1)+8))
; X) m& }1 o+ U$ g; Uns_marquee.left-=copyspeed8 P+ j  W0 ?7 ^" D
else
5 @2 u! p9 p( D# lns_marquee.left=marqueewidth+8
! e4 b6 ~0 L5 U" t6 I: e: L+ a}
  ^3 A" b+ t# w9 N& ]: n5 c, t, u}/ q+ J4 u$ |6 R# Z3 {( V; l

1 k. N& `( H' d! [if (iedom||document.layers){5 }5 g" A" ~' u0 c+ g: ]' `
with (document){* g# p) b4 n4 |* \. A! P/ d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). h/ m! X- T4 N+ L
if (iedom){
& D! G  Y0 y' R1 k; v3 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" c* ?0 F  Y" o8 N# l6 }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ V/ n. H, H  g9 X, ^& \0 {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 G: K- F  u3 |! F8 a' A$ a
write('</div>')
' B* S$ D" u, {" T: I6 G8 I' A# b& b}
5 p7 T" ]: m/ Q; H: V. felse if (document.layers){' ^7 N* J( `( Z) o# Q$ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) g3 k3 ^$ T2 }6 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 V8 W! J: z" S: \
write('</ilayer>')
5 p# i1 s" S: P+ s4 p}" z$ S. u4 x/ N* G5 J
document.write('</td></table>')
+ l% n$ s- t- ?* `0 j}
; P0 h2 P- P3 m9 i  B}5 Z+ I, k7 v/ `. c9 j* C+ P3 ]
</script>

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