返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* f) k8 t# H+ b/ S% O( _var marqueewidth=3007 Z1 h! t+ q5 c# Z. U% i
//高度
$ T' J9 ?0 t. b4 l1 T+ h* Kvar marqueeheight=25  W+ ]$ n  o2 K0 t3 [& L1 E
//速度(1-10)2 X/ v- C( O9 S& q% h
var marqueespeed=3
) Y6 j9 F! |3 m3 m, `, f. t//背景颜色
' l/ H3 m2 X$ D+ v; M" C/ Nvar marqueebgcolor="#FFFFFF". h0 G+ E- S! L6 m5 C3 b
//是否能暂停 (0=no. 1=yes)?
, a' G+ ]5 l, T! xvar pauseit=1( F) w* w$ G! x. Y3 T9 N# l7 u

; C, Y/ Q5 U: A' Z) m" G//修改显示内容
% Z+ F$ L! S9 T! B  \3 y: P% Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; W( [0 s0 A1 a, i: D1 A3 ^0 |

; z$ e- N. @' M7 X3 o9 ^; ]+ x5 a' @' ^
////下面不需改变////////////
0 l- v. {6 R6 l6 ?' n: g- H0 y) J- W' ^& X6 }$ \# [& w
var copyspeed=marqueespeed
# H0 v( L' p, @" |- yvar pausespeed=(pauseit==0)? copyspeed: 0$ s( E' o! |, @9 B) i& ^! o, C1 b
var iedom=document.all||document.getElementById
" J9 {9 h( K; ^2 ?3 m; k8 s/ Gif (iedom), M0 c% C, j0 r9 e- w. z5 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& W* c* A! ^* B6 D$ |" V
var actualwidth=''
6 h4 m5 F3 ]1 m3 s3 s- h: fvar cross_marquee, ns_marquee# T$ N6 j1 w' H; `' e: ^5 y

: X) y$ k9 R) B8 m4 }function populate(){# ^( {! A7 k. _; @0 _
if (iedom){
4 W$ @- I* Z1 a$ z8 C, Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 Y- U1 L1 O4 h: f1 Icross_marquee.style.left=marqueewidth+8" J, Q8 d# `- V0 S6 z" x9 v/ y
cross_marquee.innerHTML=marqueecontent9 Q7 u" w; \5 s2 c7 W3 e6 L) _+ q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, }  ]. o8 ]3 _( k1 W}& B' P( R! q4 W/ _" y8 r, z
else if (document.layers){
* U0 E) @7 V# F( A' p5 c2 hns_marquee=document.ns_marquee.document.ns_marquee2
$ t# G! ?# `$ \/ p- O: e/ Vns_marquee.left=marqueewidth+8
2 _9 b0 Y% n3 {; o$ w0 N" L, Kns_marquee.document.write(marqueecontent)
4 u8 \9 L2 e) s/ S& k# Vns_marquee.document.close()
1 @, m; Q8 S* {5 t  a) b9 hactualwidth=ns_marquee.document.width
, K2 r8 m+ D! f3 K- m) D' n}
* ]! K  L2 l7 M+ [lefttime=setInterval("scrollmarquee()",20)
0 \9 ?8 U# |0 s% A, B- M: U}6 X" o, ]7 l+ Z, B" T$ O/ E' L
window.onload=populate
8 v! w7 ?# H+ B1 U# \% p  q" c2 h, t$ X* G4 h. `
function scrollmarquee(){7 b8 ^6 a& D7 m" c( E" ?' C' ?0 E
if (iedom){2 C; ]0 O% `" I$ f# m/ J! A- `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& i9 d- s0 H% T% {! M% ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ x% ~  i: C' f, N$ P+ H' b
else
, m! k2 V# n2 M& h, v! Mcross_marquee.style.left=marqueewidth+8
& ^8 [% w. u1 m$ e
- Z) i/ g/ p5 ~! b* e}
7 t* `& i) q3 velse if (document.layers){
6 F1 r6 e% S: B; }" d& ~; g5 bif (ns_marquee.left>(actualwidth*(-1)+8))
1 ^# n6 h# G* k/ I# ]2 b$ dns_marquee.left-=copyspeed1 T" W; ~+ c( ~4 z
else5 J8 g) N# [  i/ p7 _- _! C
ns_marquee.left=marqueewidth+8
' ^$ }: a# ^; F4 }5 n3 m! J}
( d2 t7 N6 k" k  Z}
& T* Y2 R2 I5 [2 }# ^' M4 ?; l
' ~1 Y/ g0 Y/ P" ~* Hif (iedom||document.layers){2 s8 B$ l! f$ M+ ]
with (document){4 K' c# p. U* z- G3 Z" y  e! ^' G0 Z8 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* G6 W+ D) O3 r  M, [if (iedom){
% y4 c7 ?8 g) ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 A7 a* x1 T4 b8 `9 V0 s5 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). U% b0 O4 P% H1 w+ w" M6 F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 X! J% s+ Z$ b) Rwrite('</div>'). [. T$ r+ A/ q
}
5 |, O& A6 V- q% P8 p9 X3 V: F' Kelse if (document.layers){* E) L- p. X9 y2 t1 D5 {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- w: A2 e; x  N( f2 f8 C/ O. `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% U# I) H% d" {2 O! s0 L+ a6 mwrite('</ilayer>')
0 N: r+ Y8 B( x, G2 W" t}- R0 ^9 d5 H8 I5 H
document.write('</td></table>')
6 x9 n. t* {; z0 M}
4 y. c, e/ l1 _: I  l# N# D}5 l  C7 P9 ~( i1 [" `' R9 N0 M
</script>

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