返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 N  R) {8 S1 C8 g- v3 o% Mvar marqueewidth=300
2 K4 B+ i, d. F% _" N- F& r//高度( ]6 j+ B& E3 y7 W
var marqueeheight=25$ k5 b5 `/ E6 ]! {
//速度(1-10)
2 D4 K: C  N$ c. }9 ?, tvar marqueespeed=35 _  p0 g8 ~: {: o
//背景颜色
( r& R4 C/ j, E5 _# `- f. nvar marqueebgcolor="#FFFFFF"; F5 J' g# G3 \* S$ R9 w$ s
//是否能暂停 (0=no. 1=yes)?
% p  v, m2 W) F; e2 o2 J& fvar pauseit=1
1 p) ~- j+ O* r( m2 m( c8 u2 G
& _9 u: T  t# G6 o2 i/ O//修改显示内容3 f0 @* o" ^, v/ l! ^1 m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% i8 p- H; t3 N2 l  y

- D" i6 t; }+ `" Y9 [* T
/ I. U. x" K' |2 K) c# P////下面不需改变////////////' t9 B( L3 C  x6 `8 B

3 G* \: H7 b. R5 I+ f# w% ~var copyspeed=marqueespeed  s4 d* e: N4 v$ X7 A" s' d2 Z
var pausespeed=(pauseit==0)? copyspeed: 04 y6 v6 U0 o7 V/ R' _" b5 y$ f
var iedom=document.all||document.getElementById/ l% V2 r( Y: z9 y: I% s! z' w
if (iedom)) b" M( J( z+ _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) Z; A" G- z- R/ Avar actualwidth=''
2 H4 m8 S- Z8 r2 Evar cross_marquee, ns_marquee( U1 l  N2 [: n9 D# j" |

5 e  G$ k6 H: ]2 Q) s6 v' Z7 yfunction populate(){
. j) w: D( z1 Y5 k# F2 lif (iedom){+ k1 l8 Q8 u( z% z+ Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& F; H3 G: a+ @9 P3 u& Scross_marquee.style.left=marqueewidth+8# W% W0 k4 @( w
cross_marquee.innerHTML=marqueecontent
8 Y) F( h$ ~4 {' M" L" M3 f' Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" q% M# v0 ~- t3 A2 G# F
}
' I7 K0 ]. Q6 q) ~- B$ `& Z$ ]* E6 }else if (document.layers){
7 Q5 A- L4 F( C1 }8 ins_marquee=document.ns_marquee.document.ns_marquee2
$ z) Z" \& J0 Y) Kns_marquee.left=marqueewidth+85 r7 w) w4 J- v/ B; T! m
ns_marquee.document.write(marqueecontent)) A7 Y0 Z- K# j+ i% B
ns_marquee.document.close()
* @1 i" E$ `+ factualwidth=ns_marquee.document.width# f" c$ [. b, a  N& v
}9 h% W5 N# T% k+ ?
lefttime=setInterval("scrollmarquee()",20)! a. e, r6 w0 @4 L
}
3 _# j3 S8 i2 Kwindow.onload=populate
5 r+ L2 e- v" `, A7 `- t! k& g0 |9 p9 r- F
function scrollmarquee(){
0 c" `6 U: K$ {7 \0 Q' rif (iedom){& y2 v5 b6 H  z" l4 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 F5 \# S' s, b. i+ M* ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' s& G, O+ N% Q" W( Y) Q0 ?7 Yelse8 l% m/ y5 Q# j6 B- w
cross_marquee.style.left=marqueewidth+8
; k! \4 _# k: m& C% m  ~  {1 a7 J- N7 j$ n
}
, V3 R/ y8 p& S% p- felse if (document.layers){
* [) U5 c0 V, yif (ns_marquee.left>(actualwidth*(-1)+8))
9 T% P( F: u! J+ }1 p7 vns_marquee.left-=copyspeed$ d  j7 V' x/ G1 o& G0 ^; R
else
& c2 o" k; e  m# U" p# Xns_marquee.left=marqueewidth+83 [1 R' @' @8 t
}
1 I' Z+ k. G  ?' r/ _9 f4 t) @. J}0 Q$ ]2 C* o5 [) B; i/ y
9 ]1 a4 m3 q2 G% |$ Y4 U5 d
if (iedom||document.layers){- w! j6 W& o! w6 ~
with (document){
0 ^/ b3 c- M/ s4 Z6 `* e7 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 i$ I. V( B9 s: @/ J2 E7 _
if (iedom){
! k% z" J7 k" y5 U3 ^$ swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, ^1 b) l6 x" ?7 U7 [2 ~; F2 [+ c% Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 e* Z7 q9 r. R. O4 W! Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), t1 H% f) H1 o3 {' g0 d( D* E  a
write('</div>')
6 {. y# t5 u0 |# M3 j}
1 f1 u) q: ?# T( w/ Celse if (document.layers){( e: }9 R+ S. h0 b8 L  |& I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 G' p/ J6 z3 u# a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 ~! @8 j& g8 T0 [" G) n3 A
write('</ilayer>')
' b9 G1 O  m0 Z1 B& D' `; R. n}
, h6 j/ ^) S. }% O0 vdocument.write('</td></table>')
7 Q6 Q# s/ T! s# ?- E0 l}
' ?! P# f+ V: N3 J, a, p' X}
0 @" k/ g; l4 r* W4 K</script>

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