返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 `, [  K6 D" k) [' A
var marqueewidth=300% o2 e  U" ]: M7 T
//高度5 b& l! e! s/ z! _8 D' W$ X' m
var marqueeheight=25
0 d, q& ?: _* F, [//速度(1-10)
0 z, n4 Q5 M) W# @0 T' T$ o2 w8 Nvar marqueespeed=3) K: W- T4 _; |/ [5 f; @/ ]
//背景颜色/ L# f9 _4 x. H0 v
var marqueebgcolor="#FFFFFF"
, S- V( {. I* K9 ?( G//是否能暂停 (0=no. 1=yes)?
2 I; R9 R! y3 P% `0 mvar pauseit=1
& ?3 j9 c0 F. H: }1 j# y* E7 t6 }) R5 x: p# u
//修改显示内容
# s7 I# f$ a. W5 Y8 K3 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, r+ K! P- j8 F0 c( G6 \" Q, v& \; \3 R7 h" k! s1 l
4 q5 v( i% F8 ]% y9 f* M
////下面不需改变////////////
, p9 ]  }2 n1 m8 Z& v  G/ A1 }5 n5 J/ j( t( @  U  m- V, P
var copyspeed=marqueespeed
4 a! \6 ]) }0 {# d' y+ lvar pausespeed=(pauseit==0)? copyspeed: 0* o0 e5 m8 X" y, P- \
var iedom=document.all||document.getElementById, D% |5 [1 p6 ~, }8 k
if (iedom)
2 B' f% r8 l: M2 V) ]4 [0 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 G- v: K8 x, ~
var actualwidth=''
% |2 i* L4 q7 C; @$ ]* f, Fvar cross_marquee, ns_marquee
8 r) ~+ g9 D5 A( K
! m9 o3 a0 {/ b" a0 wfunction populate(){3 D! u3 t9 _2 M3 ~# [
if (iedom){
3 a) F# F) p" R5 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 m9 _0 t# W- \1 V) N  n( \cross_marquee.style.left=marqueewidth+8& J- N* E1 E# r* L% d
cross_marquee.innerHTML=marqueecontent
; j* X# z1 B. G! p# ~5 i8 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( ~/ p' s7 F  q$ A8 ~9 e# R5 _
}% [3 x! i. G$ R8 t
else if (document.layers){
) S7 c, N5 u8 s& p& Vns_marquee=document.ns_marquee.document.ns_marquee2
8 X, ^& w$ z+ `) h5 @# B4 b+ Mns_marquee.left=marqueewidth+8
5 B5 ]# d% {) K( o' Lns_marquee.document.write(marqueecontent)" n$ n7 e: u4 ~$ ]
ns_marquee.document.close()( J0 q* b  a9 c4 G6 @- o/ [0 m
actualwidth=ns_marquee.document.width
% ~) C% g- s( w( d* A, d$ e3 Y}
3 [+ _2 N# a8 z- p1 k# V$ w; ~lefttime=setInterval("scrollmarquee()",20)
, k! }4 ^6 ?+ c- z5 ^4 X' v7 C}1 |  U0 Q' U/ u( o9 d7 g
window.onload=populate* a# `, e! U# l+ i6 g5 r$ i

4 J- f0 r' |+ _- A. g, Wfunction scrollmarquee(){' B( w" {, }2 Q* W0 `* B! j$ C
if (iedom){" ~9 Y: L9 _# g( w. b4 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 C! ~' h* O! s$ X( dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: M- X0 K8 n2 m/ G' S
else4 i1 m- |  d, w; Y$ F, \+ o
cross_marquee.style.left=marqueewidth+8
) k3 g- Z& `) g0 }  G2 t! V- ]! I) r' c, O
}
; O/ Y( `' `- c& Q0 `. [2 X  }else if (document.layers){1 T1 }. N. u2 B0 _7 W; a& l$ ~
if (ns_marquee.left>(actualwidth*(-1)+8))
2 A0 [. W& J! Ans_marquee.left-=copyspeed
) }7 G% f- d$ L4 B0 c6 W9 L6 pelse
5 i% ]: i9 A% l$ u3 Y6 {% ons_marquee.left=marqueewidth+81 V" }! T7 ~3 \$ X# y3 ?  V6 n# A& i
}
. ~! D( L* N- n0 G}
2 W9 [- s! `" d/ L) q% C- P$ x
! O2 `2 S1 ^3 d" y/ ]( fif (iedom||document.layers){& `7 ^# \- l0 i* B. {6 v
with (document){
3 g8 X+ i* y. B4 T+ C9 m: V1 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! j& J# r- `6 P+ P; u. j  X& e7 F
if (iedom){
/ `4 Z0 Q2 T7 Y8 B# P0 r, Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). [- v9 I5 S# S# _& |% e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 f" H3 d# J0 C. Q% d3 q4 b& t" q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' Q( s8 S5 _$ T+ o* J& rwrite('</div>')
$ Q( v; n9 d( \) q3 J}
, @) }: |  P0 g9 V8 M3 z& Kelse if (document.layers){
! R. H* j; S1 n9 o7 ~. e% f$ z* }  kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* ~/ ]( r# b% w" _3 j; D  g: `+ M+ _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 |2 U3 U. z2 @  }( d0 |write('</ilayer>')
8 |  Y6 y4 H2 k5 q4 |8 E}
+ j' b9 f! v+ a8 `  ydocument.write('</td></table>')
4 [; a8 h' w; O2 k+ R, I* U}
9 m  A% N& g" I) F7 v' x& X0 g}) t" |6 {  ~' r0 k; y/ j% S
</script>

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