返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 D6 B1 e* W: P9 e1 i& tvar marqueewidth=300
6 _: A$ S$ k* c  }/ _: V! y# b//高度
- y7 ]6 D4 o/ L6 s6 C# qvar marqueeheight=25
8 H2 m, d4 Z% V! Z& s6 Y* W//速度(1-10)! F9 N+ U( W& k
var marqueespeed=3
6 J5 G+ g: z; {1 c. F' i6 t//背景颜色( n/ l, e% h1 p- B7 x
var marqueebgcolor="#FFFFFF"
8 v0 {9 x" _8 ~9 o+ A" ?# _% Z+ b0 n//是否能暂停 (0=no. 1=yes)?
  q; v) A; U$ m5 C! Vvar pauseit=1
. e  u+ S: g7 A/ I& e- `9 ^3 k) x
//修改显示内容$ v7 I5 I9 {2 L( v$ E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 c- J6 Z! j# @( [
& y4 ^9 L" }, K, w% x; W
1 c# N0 r1 l4 w" ~; [* E8 a/ `1 Z////下面不需改变////////////- E9 I& b0 ~2 h- f1 w6 S2 B# @

0 n% L" G3 ^+ o& x! cvar copyspeed=marqueespeed' c/ p  E! ~& _8 L/ B
var pausespeed=(pauseit==0)? copyspeed: 0: p# N! N% I) O' }; R
var iedom=document.all||document.getElementById" e' s. n6 w- |1 X2 E+ i
if (iedom)1 c% ^9 V4 o" }$ ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" |4 A; F: \% J/ Y8 [5 t# I0 @
var actualwidth=''
9 h  m; B  y# U5 ^5 u* i8 uvar cross_marquee, ns_marquee: \: v6 D6 i. K4 f: t: J3 {5 {) ]

. \/ I* n& E1 e3 Z; Sfunction populate(){
, G+ P" ~2 f! V) _  I1 \, \' tif (iedom){
$ N/ `$ e1 k% L. s1 C6 ~5 Y) A- dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) a- R+ a* V! q3 B% ^6 h2 l
cross_marquee.style.left=marqueewidth+84 D, w0 y: V2 R& U
cross_marquee.innerHTML=marqueecontent# T. P) |2 G* b: c5 @; J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 I- u2 }- J' Z5 s& d( L: w
}
( T+ w" N7 a/ \$ i$ y# J, oelse if (document.layers){
) r- b  p$ Z0 W, ^# N0 @ns_marquee=document.ns_marquee.document.ns_marquee2
& V) J# f% \; v& f9 Wns_marquee.left=marqueewidth+89 t- f6 {" u1 H" b3 ~8 |
ns_marquee.document.write(marqueecontent)  s7 F# ]4 Q6 H7 V; R
ns_marquee.document.close()( _+ f  w) A; c% A) ], e" n
actualwidth=ns_marquee.document.width
- ?/ a& w# M5 W" z: _6 _}6 H  c) ?8 w- n; l: e7 ]: D6 e
lefttime=setInterval("scrollmarquee()",20)
1 @0 M; [( P7 b& Y" ^0 n}
! r, h5 |  A8 n  j/ P4 N+ Gwindow.onload=populate
) w% }; w! e) D" y9 F) D6 q. Q: O3 c0 V* T. d$ @
function scrollmarquee(){
) |" z! n" l& Z* Z/ |if (iedom){
5 i) O* G) q0 Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' L- L* t/ S% h" `) Y  \: o% Y4 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ x6 u) D! B% i* e) U- [% d9 E/ Q  g
else0 K5 g2 F( v+ I* t
cross_marquee.style.left=marqueewidth+8
8 w8 j3 A0 W5 D; ^$ I, O. m1 r4 s7 x, V$ Y& b' h
}
8 V, T3 }1 V! Q1 Celse if (document.layers){
' r- g* ]+ m; Z# g. Cif (ns_marquee.left>(actualwidth*(-1)+8))
3 S+ F9 k6 O9 l& Z. Ans_marquee.left-=copyspeed
, F) K4 g* W" Velse
. y: x% ^/ ~9 D3 l+ X* L4 zns_marquee.left=marqueewidth+88 T- t$ F1 J% h! h8 a* ~
}
- ^# c- p1 ~/ Q/ c6 \: `6 n8 z}% B7 C% [  j) n/ Q( j

4 X3 m( Z) ]" V- n+ g  D' k9 \if (iedom||document.layers){6 B: D" N8 z, x! I" Y% Y! J1 t1 Y# y
with (document){
: g7 R% ?3 H- z. ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 h) m$ Z" V; O
if (iedom){5 l4 ~6 k9 y; X+ \, U0 ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& F- X3 b7 s6 @, b$ x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' z- A! F1 g9 E6 n0 q7 M! V' @! @( T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  u1 S1 n0 b8 P& a' [& W
write('</div>')
, i/ Q* j. }4 w' H+ M* B}
( N, {( ]2 S) Welse if (document.layers){
+ i; C! ^! S# N) j5 _% i: {% x' gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): M; ~1 ]# W: [9 q! M7 \9 c0 N% a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  `9 }% P3 q2 _6 f" w' R9 _+ j
write('</ilayer>')
- j, e" W! y& W* ]% G9 ~6 D! A+ G}  ~% H' U* D5 `, I0 ?* f3 U$ e, @
document.write('</td></table>')  O2 m7 j* I/ L; z' _% Z
}
5 ^# _) r6 ?4 ?$ Z}
# Y/ ^1 `- _( ?8 y& x* k2 g</script>

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