|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
" h2 A5 H7 [" ]7 X3 h( M8 W7 Mvar marqueewidth=300! W, h2 W( g" R7 |
//高度/ t f( V }; \+ W- Q3 ^4 b* a
var marqueeheight=25+ x' W) Y# A" h* p- @( T4 Y9 ]
//速度(1-10)" A8 N4 N! R ^3 e% C
var marqueespeed=3
7 r+ S+ O6 {; _0 R1 v" y//背景颜色# o) _+ P0 J; Y% \' P
var marqueebgcolor="#FFFFFF"/ f( G9 Y) c3 G# z5 r; F' }2 H( s3 l/ O
//是否能暂停 (0=no. 1=yes)?4 ]& e2 r( D3 |" u. t9 i
var pauseit=1
8 W7 T; U* r5 S; Y% N6 X i* `5 I' ~+ m$ A6 M4 \3 \& V
//修改显示内容5 O8 n% z W. {% p; ?0 M& `% } b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 G9 C7 l0 n: u6 z3 `
q) h5 x, |0 I2 e7 q! v! x
* _& n) o+ o) b' {+ D
////下面不需改变////////////
" ^8 @$ N+ M+ A* u' S" Y
8 t( e0 y1 I( D" s1 }) m+ Xvar copyspeed=marqueespeed+ x3 R5 ^2 A( L9 k3 N+ l
var pausespeed=(pauseit==0)? copyspeed: 0
0 b) p/ m) u0 fvar iedom=document.all||document.getElementById
! K9 M3 J9 N+ o9 a$ H6 pif (iedom)) m9 @5 ]$ r$ O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ L; T: f: C: V; H/ g! n! vvar actualwidth=''8 j: g' P8 @: p) ~- I
var cross_marquee, ns_marquee
5 `; B6 H$ q; i9 Y; l( L2 B1 z! r8 \
function populate(){9 `& }/ @" P6 q! V
if (iedom){
6 n# s- \8 ~3 scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" G, H; N& ^, U j9 t% ]
cross_marquee.style.left=marqueewidth+8
: k5 h0 D5 L+ B, p# g1 m3 zcross_marquee.innerHTML=marqueecontent! S# Q8 C: @6 O0 C! v2 j, l" }6 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% v/ d, m+ {6 U9 @
}, S2 y2 N: n& _8 V
else if (document.layers){
8 P( q* y1 F0 qns_marquee=document.ns_marquee.document.ns_marquee2
: Y" P* C' K" J& C. O& r$ x% dns_marquee.left=marqueewidth+8
7 H& M8 V, @' ]ns_marquee.document.write(marqueecontent)
! H- |1 p$ ?+ q, R2 Gns_marquee.document.close()+ l2 J$ i- S$ h0 _; l6 D
actualwidth=ns_marquee.document.width
: m" B5 y- {8 J/ F6 c}& i- Z7 A: M- _: k1 s
lefttime=setInterval("scrollmarquee()",20): y- r2 e% x8 \5 V$ P
}' p/ {: u4 h$ q/ B8 _. `
window.onload=populate
- ]6 h* y8 W5 s: ] o7 ]- M" ?) m" U% }
function scrollmarquee(){$ G2 {! Z/ c+ c# I- L' h- j
if (iedom){& S0 R: [: D X. x0 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- o) O) C, G2 D2 }! |& i5 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 u( \9 A+ n T, X t
else
3 ~: |5 l: d' E2 ], [5 y8 o4 h8 Icross_marquee.style.left=marqueewidth+8' x7 u0 s+ f3 x/ r
( D- V9 Y1 x6 m}
6 }% l# _! X0 K9 S) } Selse if (document.layers){+ [+ @) ?. x$ E5 y# t( b& A% Q
if (ns_marquee.left>(actualwidth*(-1)+8))
. G* H- M# i6 ~) B0 I# Tns_marquee.left-=copyspeed
; n. N) z e) t" _% N \4 |; @else
4 n s3 _- R/ G8 |! u5 N0 Rns_marquee.left=marqueewidth+8
2 i4 p5 h% u2 L, j' |0 B0 t# z4 V1 P}
5 _ V! C. _; O}
0 u$ f, Q" z& {. o. S3 x
+ ]: z1 Z: v7 Tif (iedom||document.layers){3 D- j' I& S1 h" l2 I- @1 \: R+ T
with (document){1 a, d3 [! b- t9 a, r. m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') g/ r$ H1 e2 Y: g+ h% F
if (iedom){ ~# @3 j, \+ M Q0 t- a# g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 N# }6 i3 F' a2 w# h+ b, `, M4 L/ Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 }' d# l0 k; k4 F; k7 [2 I2 t! X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ |9 R v- t: Z7 B& {' a
write('</div>')" c+ ^( }/ D( B
}( v) \/ Z# B8 f* X. Z# ?+ U
else if (document.layers){
: n, P9 e0 H6 r* k6 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ z& s6 @3 T, A$ t lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" h" m% N1 W" {) |
write('</ilayer>')( p( I1 J9 n/ @1 I, U
}, [2 p: x/ a7 H3 B* y( ~
document.write('</td></table>')
$ {% |$ q, b7 W; s$ z1 W, w# p& t}
: _. e$ N9 l% {$ y}
' v& V4 ?& k: K$ C</script> |
|