获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! Q; y; q8 l; z& s5 j) A$ o2 E' ^1 qvar marqueewidth=300, t% u8 o% c. W6 g
//高度! t5 F+ s: `: D1 N1 f2 D
var marqueeheight=25
( E" _6 v9 m9 p. Z* |' Q( {, R//速度(1-10)
7 K" }7 @, k( _% [6 Q6 ovar marqueespeed=37 L7 G  I4 I/ ?2 Y, H4 C
//背景颜色
5 o% m$ h; Z# Y. }# s# O' E: xvar marqueebgcolor="#FFFFFF"
9 `1 N* O/ j* Y' L: R: h//是否能暂停 (0=no. 1=yes)?
: f+ \$ j8 n; K  I7 Pvar pauseit=12 N; b+ \8 G1 b% d" n( H- |/ `

2 y- x+ U' b2 x4 [! y0 S. ^//修改显示内容
# j5 h/ e: j) |! u7 ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! B+ \. ]+ E) B! u3 V1 V/ w

. n& j, q  M8 M6 S$ |+ e- B  @' p3 g  R# f0 S9 n
////下面不需改变////////////
9 |. c  V* W/ C# V# X7 \" ^; R, c% M0 _9 ?6 I- s; f0 l
var copyspeed=marqueespeed
8 ~. }% w5 t+ J5 @" Nvar pausespeed=(pauseit==0)? copyspeed: 0
" l! \6 ~1 _8 k2 |* X; I* `var iedom=document.all||document.getElementById$ Q% r5 w" J6 s
if (iedom)
, _& D5 p" F7 ~& o& `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 V  J! f$ Z, I& J) C/ a2 c
var actualwidth=''
1 Q2 I  [& l4 `, a, ~var cross_marquee, ns_marquee
/ E+ Y2 t( m1 f8 h' U
5 B. ^' q( u2 Sfunction populate(){, \% c9 h& p+ e
if (iedom){1 F$ w" Y1 W& m0 J8 a$ {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 ], `' L1 q. P3 s3 c
cross_marquee.style.left=marqueewidth+86 x# a' z! D$ ~% d
cross_marquee.innerHTML=marqueecontent
8 O: U/ i8 p# Z% D, ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; G; |* V' P2 H6 r$ D9 F7 v  c}
; |, m$ O& K0 P- ielse if (document.layers){
# S! p& I/ l) T/ gns_marquee=document.ns_marquee.document.ns_marquee2! A: r; [7 T" }* R. O
ns_marquee.left=marqueewidth+8
7 H9 b  k: e  C! O$ ~( Vns_marquee.document.write(marqueecontent)
2 u2 g6 z2 j1 Nns_marquee.document.close()( ~) {3 v7 Z. J) V% Z! L
actualwidth=ns_marquee.document.width* C/ [  E$ n( |* V
}( F# u3 g; W9 M7 S
lefttime=setInterval("scrollmarquee()",20)
! R, F) y1 f% @}
* b5 R: o% a& h/ Vwindow.onload=populate  j, h) _6 j+ \1 c
7 J9 g0 x' u" J
function scrollmarquee(){
/ ?* r# v6 @3 Oif (iedom){( f6 S7 `0 s2 Y! G2 Z- ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" B/ h0 T5 I; u1 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( l3 [9 e5 T  ^. b% R4 ^) A! F
else
, X& y. w5 I6 C& A7 Kcross_marquee.style.left=marqueewidth+84 t: v2 N2 g$ b1 w. H4 @
1 g# e3 v5 S5 h4 o3 p
}/ f, Q) C8 V. a3 [4 ]! U* P# X- V
else if (document.layers){/ W4 r( v* J4 V) A  \
if (ns_marquee.left>(actualwidth*(-1)+8))
% S- D, n7 V3 J3 |5 ]ns_marquee.left-=copyspeed1 T( u( u: q9 T- p
else5 ^2 b  w. J( z$ v& `
ns_marquee.left=marqueewidth+8+ A& b( n% W) m6 y+ E$ u) e
}
, k- u& R1 W8 S* w3 J$ p+ m# j}
2 [3 j3 L2 S4 u; u2 B* z" a% ]4 f/ G7 b
if (iedom||document.layers){
4 S  l: q  k& Awith (document){
/ a5 \0 d1 c0 l( Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 K* u, |% `4 T
if (iedom){- q# {3 C# [0 r! L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* M; h; A! a; bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" F' D: g! B* I2 F0 K  Z2 iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- l: I& |' A1 `write('</div>')2 [2 y& O) T/ }
}
, _# p) a* ]7 q2 i% j) d3 R7 relse if (document.layers){7 z$ ~: \' X/ f6 ~3 W$ |& b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); W6 y( T, v- t* @' g6 V: ?& K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 @9 E$ T7 {' i! \) k& Twrite('</ilayer>')
: s/ K  s$ W; W. Y* }  J' ~}1 J2 _+ e7 [  s1 S" G! C) W
document.write('</td></table>')
7 B. P% b& ]( F1 H4 @" n}) {* T* u8 t# i( {! U
}
# N9 {$ _8 L/ ?9 \" ?; O</script>

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