返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 B% f* @; J7 m
var marqueewidth=300
3 {- E7 Y8 ?) o; t' ~//高度& J; w' L3 |- G, k9 W) n
var marqueeheight=25/ u. ^, M' I6 k" z, m% r
//速度(1-10)
" }9 j: V6 J* d! x( ]var marqueespeed=3$ C8 r+ X# Q( T3 r3 e6 Q: V
//背景颜色
" M) I0 g  [% g! gvar marqueebgcolor="#FFFFFF"9 O. S9 |. ^/ {& N. c
//是否能暂停 (0=no. 1=yes)?% ?7 r  _2 r8 u: K. U: q" @
var pauseit=1
4 v' z7 n3 o) s+ I, \$ F4 k* M# f3 e/ D7 V6 ^: q7 S
//修改显示内容
: d# s  c% E7 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( [- E; A& I. [% D2 e* J. a( |, q8 v% M4 B0 I) l
4 ?+ Y) E& ]# |# @+ K# [. C
////下面不需改变////////////
$ O* ]/ E+ ~8 p4 |8 F8 i, _( y
) {1 o) z/ q# k8 {7 Z$ @  P: ?, yvar copyspeed=marqueespeed) u5 r: j9 e! q$ R9 k, n6 F
var pausespeed=(pauseit==0)? copyspeed: 0
9 f& |& ~, }+ }" Gvar iedom=document.all||document.getElementById
8 i* ~2 P' U% K1 ?( g, vif (iedom)
5 A/ g& C8 T0 S7 n3 s* \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( e1 s% s3 [+ _
var actualwidth=''
- ^; E! L; E' b2 w) I; avar cross_marquee, ns_marquee+ p# i& d" G' z% v

9 l, Y5 d0 W. U" f" efunction populate(){2 N+ C6 C( a* {& e
if (iedom){* ]# ~1 v0 p9 ]7 U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; J7 O( {( T4 u/ ~& ?$ ]# T
cross_marquee.style.left=marqueewidth+8
" ~  l$ w' C) W! b; Ucross_marquee.innerHTML=marqueecontent  X$ m" P6 g% B) x1 ^. h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& Z1 x5 C, A& c7 z4 G. m
}, `* C8 v* u6 U* p5 C7 g( l# }, C
else if (document.layers){7 ?( e4 a/ W' d* J8 d
ns_marquee=document.ns_marquee.document.ns_marquee2
* d$ }9 t* y$ R6 t# ?ns_marquee.left=marqueewidth+8
, }0 c' r: g; k. t# ]) j$ [ns_marquee.document.write(marqueecontent)
4 h) v* n3 o. L" m! fns_marquee.document.close(); m1 Q1 q" S; i; s
actualwidth=ns_marquee.document.width
; v7 n( X, u4 {9 A- j}: k) D) a8 G& t, k/ q, }
lefttime=setInterval("scrollmarquee()",20)
; ?$ b/ C: I5 ?! W5 i) i; n( u9 ^}
4 d' u) Z7 r( b0 W: G" S: g- e2 awindow.onload=populate# W, q4 }) e1 ]; j* P& L* c( f

1 ]6 e* G" q& gfunction scrollmarquee(){
9 [+ ~2 f2 o+ @- _9 h6 Yif (iedom){, h+ L3 F- Y! n0 Q  ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- z9 F3 n9 ?( D  @. r3 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 x$ g" T9 F6 y
else. a; S: P0 k$ b! W. S9 X8 {
cross_marquee.style.left=marqueewidth+8+ x. h" v5 f) `8 _' ?% T

( V8 }& U% A4 I# C% A}
3 O8 d5 U1 d3 M6 y2 N+ B6 qelse if (document.layers){) d. y; N$ }* _
if (ns_marquee.left>(actualwidth*(-1)+8))9 y0 x& k% ~- j" t4 L8 a, [
ns_marquee.left-=copyspeed1 Z: r' t' ~: s% B  ?& ?- }  {
else
4 G9 m; e4 V1 gns_marquee.left=marqueewidth+8
2 I* W% T" D+ {0 i+ b}; w% g* ]1 s2 ^
}( d/ M9 j7 `) T! y, Y$ S7 j/ _& M

9 k& f  t% P4 S# v9 D' Wif (iedom||document.layers){2 B6 o) l5 ?, \( [. u7 [, H  y# O
with (document){% e  U0 l) k! f  u/ `% |) m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 T# g# `  {8 \3 `if (iedom){
$ y! g- N; i+ S5 j; [6 S# Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), J% x; i- N" w, ]) {' j; `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ R% j! V6 s' W: w1 M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( `6 G4 f9 G; I
write('</div>')
+ O3 C2 U( Y1 u9 H  ?8 I8 o$ y9 @}2 u2 C$ n4 g0 y% L" v
else if (document.layers){
( A  }4 f$ E8 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 F6 c1 Z6 T, ~4 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 L+ S* n! D3 M& v/ J8 [/ x$ \write('</ilayer>')
0 v) i: y. A1 A- l! s4 T  ~}% w7 m" _" C0 `9 |
document.write('</td></table>')- L* w/ a/ O: `/ P: S- G7 B) F
}
9 ?; h- f9 D" E) R8 a+ X}+ _  X* \1 K; Z' t
</script>

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