返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# ~/ W# G0 L, A9 G8 ^3 {4 Tvar marqueewidth=300
5 W0 p, T0 U% H- N: s7 k7 k5 |# J//高度7 ~6 T/ ]  a& X; W0 v+ r$ l5 |
var marqueeheight=25. \7 w2 g5 `. u: q, q$ Z
//速度(1-10)& w- u& b9 [& h8 V, m" }5 O! j
var marqueespeed=3
! }. @: G4 g2 |+ ^0 ?7 r//背景颜色- C  J! m6 p$ _. c2 g" G
var marqueebgcolor="#FFFFFF"
% O% \8 d7 ]% F' u  A! ~//是否能暂停 (0=no. 1=yes)?
4 O. a# `  Q, k* {8 @% Q1 Fvar pauseit=1( Q/ V$ h, _) k' ^- v9 e3 Q& |

0 k5 R6 q. W6 N! n; |9 {, m//修改显示内容
$ f5 o* C+ z6 F: i- Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': k* c6 j: ]+ ]0 J8 H' C: Y6 j5 f
5 K' Y5 @) g# G7 i

3 F$ o* E( i6 w" u9 ?2 g6 T! O( ^////下面不需改变////////////
, ^4 j. X* s8 V5 R. G* {, Q1 n8 w2 t5 @/ w9 @" q! V4 Y
var copyspeed=marqueespeed
) H' p* \/ n6 _, e+ R5 h( l5 yvar pausespeed=(pauseit==0)? copyspeed: 0. ~& ?2 }' [- x. C6 i& F9 o
var iedom=document.all||document.getElementById9 f; Q* A! c) W. }
if (iedom)
  ]1 \+ t; Q' I$ Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 Z' _1 |  S# Y+ X1 A7 N
var actualwidth=''( R* B& e/ h! |3 k
var cross_marquee, ns_marquee) h3 g6 Y* [4 ^* }/ e3 K. T! f

9 V9 O+ ^3 J3 Q, g4 o$ ?# pfunction populate(){- C( M. `7 L( f  f( n% d
if (iedom){
9 f7 V3 {7 o' C# Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- k( A0 R. J' B2 s4 ~% B& o
cross_marquee.style.left=marqueewidth+88 v& h- i4 y/ ^, F
cross_marquee.innerHTML=marqueecontent0 O8 M- B, B; f- r5 W' l4 A( ?1 B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; N+ H$ K. k4 Q# V}
* t/ l6 a4 `5 ]7 D& belse if (document.layers){
3 h( t2 Q* Q3 S$ U; Gns_marquee=document.ns_marquee.document.ns_marquee2
9 b0 ?% H6 Z  B5 R+ zns_marquee.left=marqueewidth+8
1 |9 V+ ~9 t& k0 Lns_marquee.document.write(marqueecontent)
& [; ~2 `, s5 O( ^ns_marquee.document.close()$ i. b/ M0 w' x6 {( h. p* b
actualwidth=ns_marquee.document.width
. |" s$ u# ~' I/ \' v* N; H}
+ }8 I& Z  Q: R5 A4 q! Vlefttime=setInterval("scrollmarquee()",20)
1 o$ B4 U, b$ ~8 }" B$ p}
8 Q! k/ M" R9 l7 S  p* Bwindow.onload=populate3 \0 V8 R3 a" y% K$ C

. e: j, C/ q( @2 _, w) lfunction scrollmarquee(){# o) H/ s) r( K  c% W
if (iedom){
1 X2 Z! B% M/ Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% u/ B; l2 W' Y( O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. M+ w+ a' K8 d) i3 Melse
' g3 E! d- }% Y: Icross_marquee.style.left=marqueewidth+8
5 _2 ~- ^$ @1 R( I" P0 G% x$ Z/ ^( ?' G0 w5 g
}
! W! a3 W5 `9 g" L4 welse if (document.layers){
# Y; O. m# K1 @$ \  V4 G4 yif (ns_marquee.left>(actualwidth*(-1)+8))4 S: S: g& O5 ], y6 [
ns_marquee.left-=copyspeed
0 o8 d- {3 q5 Y$ D, v: J7 Eelse0 [/ V+ _: d0 j7 l) w( `
ns_marquee.left=marqueewidth+8, {7 L! ^: {' J. w0 P
}
+ l3 Y& k, {( f( `6 n}
! Q& s1 V$ f+ a, I: b. @' w. {( `, }8 }- L9 x! Z+ r& }% `
if (iedom||document.layers){
' C6 N, U: ^" W0 }7 c$ @: d8 ^# qwith (document){7 d& I+ O, Y) d/ p6 n6 K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 T5 f6 J! R; c4 W
if (iedom){, f/ T9 }/ u( v8 `6 h% c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 L/ E( W  X* A4 [! R1 ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ [2 s: |0 b+ iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( ^- f) X$ A- `9 E+ O4 }$ fwrite('</div>')
2 r# E# H, J) t5 {/ u/ P. ]+ g}* F2 c) R. J; f( \# e( b1 Y
else if (document.layers){
. U" ^' C* [. Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 Q  h$ V# t2 p0 D8 X7 _* R5 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! _4 C8 l4 e4 v
write('</ilayer>')% c2 a% V* _3 h. e, T- Z# i
}& P) `/ F+ C8 E) b# N5 J
document.write('</td></table>')
- }4 {0 h8 s+ Q6 s5 ^4 w$ X8 ?( D}
* \( T4 R/ D$ o, F3 O+ ]}* d; O2 c) y' r
</script>

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