返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 A. {( s5 [+ z# H5 N8 h1 z8 P
var marqueewidth=300
' {2 r2 `* x% }1 R$ t4 u$ I//高度) F  p3 V; x- L3 v6 G, r
var marqueeheight=25* s$ V. e- a+ n" A
//速度(1-10)2 @; v) t! {% Q1 z8 A, a" ]
var marqueespeed=3( a. z2 t; J( u. f
//背景颜色
( |0 G, u# M. K6 C' nvar marqueebgcolor="#FFFFFF"% K; k6 r3 T1 K; u, d' J4 I7 P1 V
//是否能暂停 (0=no. 1=yes)?  C0 c# \. I! E+ T7 p
var pauseit=15 H2 d5 g( U& L* T2 G/ `8 |
8 Z. |3 g8 ?  W7 a  G. O. \' L3 P
//修改显示内容
9 ]  s8 P$ R1 {) nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 J/ l$ _, R2 B" u

. P) c7 {- O7 K. B8 I
- D9 s' [; C- Z' I7 n////下面不需改变////////////0 y# l# M9 i; o/ K$ ^
# u. k1 c- H# f0 _6 n
var copyspeed=marqueespeed. U. g7 N* ?3 D; S
var pausespeed=(pauseit==0)? copyspeed: 0: `% M- m2 \; v0 |" V0 C. H& \
var iedom=document.all||document.getElementById
! n8 x$ c3 L6 L3 mif (iedom)
" ?) s( j, e" \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) x( b& J' `7 @6 ]! kvar actualwidth=''7 j2 C8 H! V' T, P8 J  m) ?
var cross_marquee, ns_marquee
" y, A4 u2 @$ Z  e( ]) g7 K2 G9 H0 V- w% _/ v
function populate(){
% Z) J( l6 z( d2 ~if (iedom){. m5 Z4 L4 f9 L" K2 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& w7 n3 a3 e( U
cross_marquee.style.left=marqueewidth+8' Y/ E& N7 a0 o7 w% t
cross_marquee.innerHTML=marqueecontent
7 y) I5 B" w" H- |8 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 D# g- `- c# n; S3 x+ |) }( O}! e- q  N1 d; r6 G
else if (document.layers){, @  c# |# \3 p; `! r( j
ns_marquee=document.ns_marquee.document.ns_marquee2
7 l3 V6 R( K0 s' `# _: Ons_marquee.left=marqueewidth+8
, C1 l. y7 x+ A) X& W) m. A9 ins_marquee.document.write(marqueecontent)
5 S/ G8 b4 @: W% U8 P2 nns_marquee.document.close()4 j; J5 Y, }8 X1 c3 }
actualwidth=ns_marquee.document.width
0 I6 u; I" p: p6 M}
* H- ^$ G7 Q+ p2 }6 Y+ ?lefttime=setInterval("scrollmarquee()",20)
5 e+ U* t3 s" \( _- u}
8 A5 C$ n" ^8 d) E  ywindow.onload=populate; K3 `+ Y9 Y- A
- w, ~2 }8 {7 H: Y4 i$ N1 J& {
function scrollmarquee(){
+ S  `" u6 N. O+ d2 xif (iedom){, C% E$ V0 j7 k; s& j5 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 \4 g: a1 `2 t& S/ u6 p8 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 O0 L' w* l, _- ]! Qelse
6 H6 e' m9 y4 c" Ccross_marquee.style.left=marqueewidth+84 J4 Q; }1 @3 Y/ e4 _+ r/ ^; ^9 q

7 Q, K7 y) I$ O" A7 Y}
/ A5 X% e" o- c, r4 n3 p- [else if (document.layers){: G  n" [5 P& c$ m# S
if (ns_marquee.left>(actualwidth*(-1)+8))
/ p; o1 Y8 ?$ {0 Xns_marquee.left-=copyspeed; H+ o0 ?, k/ ~) Q. m
else
+ e7 d8 C, n, H+ k' Vns_marquee.left=marqueewidth+83 B, L& Y& c$ T! {- N
}
! a! o9 T9 @* S. x( h9 ^/ e2 E}- `, p6 @* a2 e# P1 R( p
2 R! T) P* x0 `  l. L
if (iedom||document.layers){! |( H& }3 n8 E7 Q. i& ?! B' K' I$ c
with (document){& t. ?9 q( c: F! k7 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 y  K% ]$ G" s# W  a& I8 R& Yif (iedom){, Z; y/ K4 M1 ^% n. k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 M1 J# h$ z4 @+ C# Y' [* @* Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 [7 W( j6 k1 a3 T" r1 I: \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! K) \% d# ~4 {
write('</div>')9 W3 P: p) p* V
}* t, s2 K, M9 B+ l6 _
else if (document.layers){
( \7 u& M- P$ |  }; t. `& K$ e9 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( v$ U9 \$ ~- Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 L# }/ `5 L: ?2 _" U' Z5 Q
write('</ilayer>')
. P* L% ^. l" N5 S}
0 f1 [; b' k; |. y* Z0 V3 Xdocument.write('</td></table>')
9 C( g0 k) k# X* `4 A/ ?# t7 Z+ Q1 w2 Y}$ L" i6 j3 g* x, ~! Y
}8 I1 C$ F6 u; G0 x& v; }
</script>

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