返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 u& y9 \  `& [# N0 _+ [var marqueewidth=3006 `, z0 D' |1 Z2 Q$ W7 t4 S5 l! I
//高度3 V1 M& x5 V, f+ {: {, m
var marqueeheight=25
2 Y4 ^8 E9 O# l$ [6 J/ O4 |//速度(1-10)
4 f' f! W. P; N3 e( c2 evar marqueespeed=3' G; N# ~# ]) w! M* `' ?7 _
//背景颜色
* B2 b5 b3 h# V, b0 [- ]0 ovar marqueebgcolor="#FFFFFF", @2 U5 q/ H1 ^* j: J% X3 i' k% I
//是否能暂停 (0=no. 1=yes)?
( C! D6 c  X  ?2 cvar pauseit=1
* f) A+ f- O7 |6 S( a- j. e  r& N) u/ J7 h# M% _
//修改显示内容7 R  s, |) ~- I, ?& x& v' Z2 l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 f# G/ M1 q* m/ g; T7 l$ E/ l$ B- p

4 }1 d. z7 `5 b8 R2 Z0 C% p
1 t0 y, A9 q1 Y7 Y////下面不需改变////////////7 a& D* |6 x" M% V7 ^

2 g7 f  h& z9 G% o$ e5 nvar copyspeed=marqueespeed3 Y$ t( Y+ K# s: g2 \2 p7 {! e0 w
var pausespeed=(pauseit==0)? copyspeed: 0
; k5 c& I3 Q* e3 E9 W, `var iedom=document.all||document.getElementById2 q9 K1 H% J# E% @! D! v
if (iedom)
4 k! k, _* i% w$ _& c1 A: y  xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" l7 L+ o  p' k$ Z& S4 e  Y2 Z; \  t
var actualwidth=''" K* G9 z0 W# C$ {! C5 {, d  ~0 f& {
var cross_marquee, ns_marquee
2 k/ }1 a" ~% S8 T+ q% Z2 j% L( V  B" L
function populate(){
0 R1 c' A1 T- k1 `6 a. d1 L$ uif (iedom){
, b* R) o% D! _7 _  Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# X: }  ~2 _8 m! S2 x6 D
cross_marquee.style.left=marqueewidth+8$ ^* h" V; R  B: l
cross_marquee.innerHTML=marqueecontent
8 u9 y4 f6 t  g$ R7 Q+ y) pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' L) J- p+ }- V# P0 {
}) ^6 f5 k) V! x1 ^7 }& v$ f
else if (document.layers){
2 @* V" S) }- g8 Bns_marquee=document.ns_marquee.document.ns_marquee2
  j7 e% Z; C% s3 t% Sns_marquee.left=marqueewidth+8
" G, v% V1 P; d; T- Y& ^ns_marquee.document.write(marqueecontent)
+ s# l2 a6 a3 M7 D3 A  Uns_marquee.document.close()8 y. f4 I/ p8 R: E
actualwidth=ns_marquee.document.width
8 b. H' x& g6 f0 A& h5 n7 j+ t}; x6 @4 Z0 m* s! a0 Z1 L, Y" W
lefttime=setInterval("scrollmarquee()",20)
( I+ Z; I; x" s3 _  G( h( S+ `}
: O3 z% {$ Z7 C( J$ ~& uwindow.onload=populate
3 `4 u+ P. E. L9 s) k) ], M7 ?' u! V- p; ^- k
function scrollmarquee(){$ Y$ k) q; i0 T  q
if (iedom){2 i/ _0 d% R8 s/ i2 d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" I" |6 c/ V* Z( I4 Z1 S9 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) M" M7 |8 x' n5 z4 Z: i
else3 X* G2 c& _. K% B/ ~% f  Z
cross_marquee.style.left=marqueewidth+8# ]+ X! T6 s4 W2 X+ i
+ h" {  f; }3 G9 i6 x) B, f6 }
}( N! o: e0 R  x" z' ^5 i5 Y
else if (document.layers){
8 _) J. H; m' k7 y. y' j; Q  k" qif (ns_marquee.left>(actualwidth*(-1)+8))
6 ^) C, o$ D) d( Xns_marquee.left-=copyspeed
9 r" U4 O4 e4 T7 M, Q' g# H9 Oelse
# d5 q, I" c  x! O& D# |ns_marquee.left=marqueewidth+8
7 k% U/ O" G6 ~4 h6 ~}3 Q9 |  f4 {. H# ^
}1 Q" z3 |' a) x: Q- w! ]
7 {; [. `' N. U' U2 ]6 w
if (iedom||document.layers){
. A5 ~4 H4 M+ p8 F, iwith (document){3 K' d+ R' _' }( B3 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  |' s: U% c4 F+ F3 y9 j
if (iedom){
9 _" q  ]9 y# Y0 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 E" g0 R) L7 g: [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 Q; U8 q7 a2 z2 l: P' z5 S# P2 u' z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 Y2 z8 z& N; E5 p# p" j
write('</div>')
! u) z0 m8 G  u8 Y}
$ C7 u+ g4 B3 |1 a% delse if (document.layers){
, q, C/ l* Q2 G1 o3 T5 T" @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) t% t! W- R/ i) W# {9 s3 z7 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, E9 g) R# G* I1 e" k- kwrite('</ilayer>')2 B5 F9 L+ v: C' s9 i& k  R1 J
}
2 H8 v% w& _/ H9 Mdocument.write('</td></table>'); J/ s* H% c4 d$ n
}
) A! K& u. M; P; R( z/ W}+ M/ V& y: m, c6 l! }4 v
</script>

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