返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 D* _/ ^' H& q1 g+ O% ovar marqueewidth=300# h9 H/ y5 M( z8 c! x
//高度
: _6 V6 t7 f$ @/ Y% W! I6 ^var marqueeheight=25/ Z  R) ~( d! I2 l. w
//速度(1-10): i7 Q$ I# I( A2 L
var marqueespeed=3( F3 G/ }8 g% i6 Q
//背景颜色
* m4 u0 J) x/ o; t; F0 Jvar marqueebgcolor="#FFFFFF"9 @0 i# J2 \7 S- S7 Q) E& ^
//是否能暂停 (0=no. 1=yes)?1 F- T; H- k- [
var pauseit=1" j# @, ~: U! o* p! d# q

0 G. c+ L, ]! l4 I//修改显示内容
7 R5 @' p8 `3 z, @* A) Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; c5 z5 f0 T9 N+ i2 X4 H6 h$ l

9 D  a: X' O0 q; Z/ Z5 S) x9 I# O7 b: g
////下面不需改变////////////
  W$ d! x$ o# B! E2 C: e$ N5 V& s& k$ g' A  \
var copyspeed=marqueespeed
% A) v2 }& E' mvar pausespeed=(pauseit==0)? copyspeed: 0- K2 X  b9 R- Y6 D8 S) x
var iedom=document.all||document.getElementById. m$ T8 l. Q" W! P2 G( Z( G. g
if (iedom)
$ i, O1 c/ A3 M2 ?& r0 P5 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& {% w* f. I1 r! u$ E+ N; T2 [var actualwidth=''0 f' b0 n# t, m9 J
var cross_marquee, ns_marquee; W7 x- c2 Z& s# {+ S( M

* l% l) x' I) R! x! vfunction populate(){+ I, m  o2 l  X: D$ [
if (iedom){
4 }3 Y6 ]: K5 T) gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 K4 ~+ d' S8 W! Icross_marquee.style.left=marqueewidth+8
$ {% G, s( z. X; H$ O+ Hcross_marquee.innerHTML=marqueecontent
' r+ P6 z$ }! h2 z) d. U1 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& o+ n$ e# U9 i}! H, E. n/ y/ m4 b) R
else if (document.layers){
% S/ A7 T7 y, f5 C9 ]ns_marquee=document.ns_marquee.document.ns_marquee26 U% L) \+ J1 N3 j6 V8 F" t5 X5 G8 b
ns_marquee.left=marqueewidth+8( O% t6 {; b) }  j) }+ P
ns_marquee.document.write(marqueecontent)
0 d. v! Y% f3 e& A: Sns_marquee.document.close()
- D1 ]- e$ ]' K4 i: Y- z7 Dactualwidth=ns_marquee.document.width: H8 b( J: q+ |5 c8 F) g
}
2 m2 N# |% D, ]# R) \lefttime=setInterval("scrollmarquee()",20)
+ w# x, r/ {! t' J9 z+ W! i}% j2 w4 a( f" K; n4 P- T* Y4 k* n
window.onload=populate
; Z$ s$ q3 q' h- b
2 C3 a* q5 s+ S, ~! Bfunction scrollmarquee(){" C  |2 M" u, N( E1 z' g
if (iedom){1 c1 O3 }' L# q5 u; v. i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 N9 v4 U# O5 s' O# {& @5 }" Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& q. c1 e% _1 }$ h
else( m3 t* m# F3 |9 G; U
cross_marquee.style.left=marqueewidth+81 X" D0 Z' U+ E' s$ B+ p( P" M

+ }0 F" W2 p7 X9 }}/ D; ]/ i8 U5 T+ S2 _! |/ s+ h
else if (document.layers){
/ `6 W1 }  q: |* N- G( uif (ns_marquee.left>(actualwidth*(-1)+8))
! H* w/ `- t! z. i5 K" uns_marquee.left-=copyspeed- s5 V2 G5 J7 E% k- G" ^
else
+ N! c" f6 C" u# E6 g  ]! g9 Cns_marquee.left=marqueewidth+8) J' {7 T5 X) \: _4 B; P& j. E
}
% R! X- P& C; X- Z4 F3 N7 u+ p# `* f}
, {$ ^! m# ?) D% T: C' Q6 D6 ]
8 h+ D( L4 p6 }6 _% uif (iedom||document.layers){2 z' S/ w5 `$ P3 @7 f
with (document){
+ M$ R/ h7 E" X: f6 f, s8 b2 T$ Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- u* u" [1 A# A3 t
if (iedom){; R3 f! y: k- o! N, ?( W) N  z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( `: j9 z" \2 @  g" c8 N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ^" M; {8 z* l  c) bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, |, _% m3 J4 L3 C# b3 s6 Z- z6 Awrite('</div>')
/ g2 S) [% ?7 |9 B' U+ Y' s}
. h+ m' U4 U, A+ n% Q# Xelse if (document.layers){( z# R1 {, M7 W. ?; F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" ~1 D" i( ?' V' e0 X+ K& m6 D! zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( b2 L' N, V# e1 h8 w4 r
write('</ilayer>')
, E2 s+ B7 v' }% Q' N5 \9 d}# I* D+ s2 N. D4 P
document.write('</td></table>')( a2 ^  ?. n# i6 Z; z
}* @/ G0 m) {2 M. u
}
5 [+ Y" g" o5 K+ A</script>

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