返回列表 发帖

网页之跑马灯文字特效

//修改宽度, z  n  x/ f( O% A) z2 C5 _9 ^
var marqueewidth=300( W5 O8 [, P; Q3 x) C0 ^
//高度; c! w- t  j1 E: f! Q
var marqueeheight=25
( d/ j8 p* w( z' S' a//速度(1-10)
# l; \2 P3 t. H, vvar marqueespeed=3
3 s+ y8 V) h  k" Y# r( ^$ I$ X" b//背景颜色4 M7 V  o$ v2 h! r/ y5 [1 d! `7 ]  X
var marqueebgcolor="#FFFFFF"2 k& j+ P9 X' K7 A# V: l; }( V' L  I# P8 a
//是否能暂停 (0=no. 1=yes)?
# @4 i; ?/ Y7 I# H$ b1 S( P8 x" Hvar pauseit=19 Z! Q+ A; ~/ W6 G; a* }- w1 M
5 N6 f: \* o2 [1 v0 I5 d7 L5 Q% Z
//修改显示内容
( H" K9 s- u, q; vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- \% k  b5 Q; Q/ j: V

2 p+ O9 e4 A. x( m) T" ]# N
  }% s% |: ?/ Q- x////下面不需改变////////////
1 `6 i  u/ ]' l" I
& i* l" E- O+ ^: t0 }var copyspeed=marqueespeed
; D6 H2 M8 h, g: z' ~var pausespeed=(pauseit==0)? copyspeed: 0  y! ]- q" ?; `, Q6 z
var iedom=document.all||document.getElementById/ P: f& l2 D' c6 U0 Z; @7 G
if (iedom)& a% F' S2 L5 t" W! T4 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. Y. o; e$ `/ K; ~- K$ Qvar actualwidth=''/ `6 h8 k, G3 i1 I& k4 a( B; E3 ^
var cross_marquee, ns_marquee
. G: O2 u6 M' r/ V; m  s9 S) L2 E. U7 z
function populate(){
4 ?: I  w  {+ U) g5 fif (iedom){
2 p5 h1 s. H$ O; Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ o1 ]  c4 m# Q9 O! y& P/ d( u
cross_marquee.style.left=marqueewidth+8
% \6 Z% K0 W* v5 Z2 D0 ocross_marquee.innerHTML=marqueecontent
. U( x6 @( h1 n& U/ {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 E, m- J- y% q6 a- h4 k( y. g& _}
* R6 u' i) e* A- R2 v+ v: B: Nelse if (document.layers){6 L5 n3 I8 z8 w- [" v
ns_marquee=document.ns_marquee.document.ns_marquee2) V0 P9 ?( ?3 I
ns_marquee.left=marqueewidth+83 U, r- h6 N4 Y& v7 W# @) t- u
ns_marquee.document.write(marqueecontent)# k! w, a6 w2 a0 }/ K, b
ns_marquee.document.close()4 Q& u) U8 Y3 Y8 h9 b6 X; y
actualwidth=ns_marquee.document.width; ^  {8 }) g: v; c. k- X
}4 ?' }( ~% U/ Y7 z" U
lefttime=setInterval("scrollmarquee()",20). \2 }) m3 C$ `& I/ c' ], i
}3 a8 R. G! v# ^6 ]
window.onload=populate
, ?& ^* y- `8 b, d' K7 K9 E6 s! x, z
' P: _+ q# k% @, {7 Q/ C  vfunction scrollmarquee(){- w! Y6 Q& F) W  m' F* h1 n
if (iedom){
4 g* X5 a! e6 W7 O; H7 |. ?. P. Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" Q  ?/ f. i. `* |) w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; u- y: g  Y: D- S/ Relse) a$ x1 Z& s; x! ]# J0 |
cross_marquee.style.left=marqueewidth+8
8 W! j$ f0 T4 ?0 X5 A5 n( u. D" N9 @2 C( r$ p8 O3 I$ R
}2 V8 y) k, A8 Z- r. _2 T
else if (document.layers){/ r# G- h( o8 ^9 g" w2 i3 f3 r0 K
if (ns_marquee.left>(actualwidth*(-1)+8))
' k. b' g& T( A) F% H% Gns_marquee.left-=copyspeed7 Z) ?/ X) o, |' E/ W: {
else
2 v& V, y: g0 ?% V& ]( Kns_marquee.left=marqueewidth+8$ R) u; ?! S0 b' e; x( M8 Z
}
1 c# |0 f9 F: Z) y; Y}
8 q# L* s* ]. g5 W: ]3 \. P. N- a7 v4 M0 C0 h
if (iedom||document.layers){
5 D. r% `* F- w; J1 ~- t1 uwith (document){% W- C( Y: P) ]! V* T  m6 x( z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' Q1 R) a: d% i% t1 aif (iedom){: o8 y# R( o$ _  E4 A0 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); A" B$ `& \5 ~6 h/ n( I& Z2 m9 L, M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- y, T' ]6 Z+ U# ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ M$ C( ~. y2 r! \7 b  `write('</div>')
* e( T8 q3 E+ d& w}6 y; T' Y! {0 r! X% L
else if (document.layers){
$ b# v% }' y9 c$ p# e1 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- q  k, ?3 Q! Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# w4 M6 z- y# d2 ^$ A  P
write('</ilayer>')0 s3 M' N+ w. m; M
}
+ X/ w0 g+ V6 n5 H/ M- Bdocument.write('</td></table>')5 m0 r) ~: F& X0 L7 v& a
}/ n7 U* C0 r0 @; b
}
+ S( N% [1 \5 ^6 H) Y6 G</script>

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