返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 m9 a$ I2 K1 e5 l1 Q8 ?- }" W& G; Evar marqueewidth=300
! ^3 |% N/ e+ V& _0 m. b//高度
9 Y! E; g. n0 l2 `# F) n  f8 Lvar marqueeheight=256 ~* }6 o1 E8 R1 I
//速度(1-10). o0 d$ V5 x! w6 H3 |- Q9 w
var marqueespeed=38 W: S# n5 P0 Z2 f" ]! O5 x* P
//背景颜色
  M% W# Q' ^! N5 s0 ~* ^var marqueebgcolor="#FFFFFF"; D- t8 d* y3 l7 Y9 q
//是否能暂停 (0=no. 1=yes)?
! |: G  _# }) H7 R6 u. h3 Gvar pauseit=1
$ h3 D3 A# [  D% l: I7 o  Z9 h, c0 z
. Q5 ^8 }0 p% F- [//修改显示内容! Q! [# T6 U; M0 Q" [9 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& b$ o0 I$ c6 K7 n) s1 S

8 S7 Q( c5 I, }5 l! Q4 y
! O& e9 h0 ]( k" G/ z' `////下面不需改变////////////( L: u- r5 C5 ^
! d/ n: Y: e- [" ?# R% C7 o
var copyspeed=marqueespeed
1 p; R  }6 o9 c6 V  Y2 Y' z# b$ z* Svar pausespeed=(pauseit==0)? copyspeed: 08 `1 h# n1 `: l9 @) y/ W
var iedom=document.all||document.getElementById
- a, J" J; W& [; D, k" d9 Z6 b' Vif (iedom)+ U9 b+ A8 |1 U7 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 n2 ]" v  ^4 @1 z% d
var actualwidth=''9 W6 ^3 D$ E9 r* ]/ u3 e' r
var cross_marquee, ns_marquee# @# t, n7 T  S3 _! Q% T
0 y! Y! c/ ]$ i4 u% G% F5 Y
function populate(){! G6 T% j5 i% Z/ n, b( P
if (iedom){
4 k3 l3 h$ [4 M+ c: r+ H' J/ gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. x6 a! ~7 ^- c) h6 V% Q7 ncross_marquee.style.left=marqueewidth+8' Z: ]% g0 P0 I7 g8 @; j
cross_marquee.innerHTML=marqueecontent4 @+ W3 s; c  ~! q9 E$ O" h) W, q9 [* ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 G, Q. n( s3 @7 v: Z
}+ Y+ c% I9 Y6 Z5 l% V' R# u1 ]1 ?! X2 G
else if (document.layers){
2 ]& ^* s- M4 H5 p1 ~. n6 |( Zns_marquee=document.ns_marquee.document.ns_marquee2$ f1 [3 ?2 E& l: J
ns_marquee.left=marqueewidth+89 B6 V5 Y6 I9 M# i3 @" ]" Y
ns_marquee.document.write(marqueecontent). {; y  T! z" q1 P, ]! [
ns_marquee.document.close()6 A- o2 c6 V6 S) [5 I
actualwidth=ns_marquee.document.width2 e) Q/ K2 _% w8 Y3 I
}& j# L! T  j+ p7 \2 R- A( Y
lefttime=setInterval("scrollmarquee()",20)
/ b% e: b( l9 m9 Z& }. h0 R}. }  }5 h) M& e- _! b( }
window.onload=populate
) S9 d! p# _% o7 y& ?8 K, x* o3 j" G2 F: w: L+ h
function scrollmarquee(){
( a  s) d1 R/ ]) n! d  ?2 M+ N) ]& O. rif (iedom){5 o. h( ^# ?1 g  p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! L1 g- M1 t% a0 |4 @( O# I# }, v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- k5 L' b; q( p' s
else
# z$ v- i1 ?2 Q' p- qcross_marquee.style.left=marqueewidth+8
6 o- U% ^9 b' t) q0 b' o% C+ A: X, K
}! b! H9 q0 R( h+ e  {9 n
else if (document.layers){
8 X: `9 ~. ~* z, K7 q7 Q* E# Yif (ns_marquee.left>(actualwidth*(-1)+8))( h1 ^9 m/ |$ ^2 C( o) l) K
ns_marquee.left-=copyspeed! g& g! L1 Z1 q
else
# p; O& s2 E# L7 N9 d4 _$ Ans_marquee.left=marqueewidth+8* I$ U/ t8 e; t
}5 L1 a, K! T4 L$ }9 S, p
}
, r+ w: M0 L3 G9 p( J! A" P7 D# [/ F4 `5 j5 I# G( [8 ?
if (iedom||document.layers){
3 _2 ?2 p0 r# Z7 twith (document){' x" u$ s( O2 _' D1 O/ c8 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( c3 L5 v! ^, O9 Aif (iedom){
$ b0 S1 R( c8 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ Q& w) ^2 G1 @5 |) Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# S6 m. h- z- m, a" `* R( twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! }" |# [  }+ M1 ^6 U$ \, J
write('</div>')+ ]0 p5 m& z1 b% F
}: h# c, l; g, R* i& l9 {* r( K3 x
else if (document.layers){- D% @4 o% q5 g4 e! I1 I% U2 H2 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 E6 X  F! {9 a' B) q+ G. n& t& Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( U; u7 w! D8 q( m. ?. c. ^write('</ilayer>')
7 H$ [+ t" e+ w. h: h: F' T}
1 l& a5 }+ i! M7 \document.write('</td></table>')7 Y$ p; t  s: W0 \% m" k
}
' v7 a& U8 }' x! |: |) i4 m}
  K* r. G' [/ |& o2 D</script>

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