返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 B2 T, Z1 Q6 s# n1 |var marqueewidth=300. O! D- G5 \$ U: ~2 e
//高度
  o0 b$ W" H- z6 A$ \# ^' bvar marqueeheight=25! K8 V3 W. U( N
//速度(1-10)* ^  }) X* R( H* \) Q# q+ F, b9 X
var marqueespeed=3
+ Q  i7 n, V) z. p! n//背景颜色& s' N) {2 V* H: ]  m+ t& U  W* u
var marqueebgcolor="#FFFFFF"
6 Y# ]1 `2 P8 S. `( O- y; @! P//是否能暂停 (0=no. 1=yes)?1 U% S% f' W1 k8 P( Z
var pauseit=1
7 I: [. }" q" Z  o4 J! p4 S) k$ L- }* c3 A8 L& c0 e
//修改显示内容3 `3 y# y1 r) ^1 \& M  [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; s6 e/ N! }1 Q7 o& g! S
; }$ p1 W! t7 ]8 D

6 v! `1 J1 y1 k6 p6 b9 i////下面不需改变////////////8 f& U; [. l, l+ F1 R# E2 }

+ O( @. |8 J. _var copyspeed=marqueespeed  Z* ?- d7 ^1 D, w. }) |- `$ t
var pausespeed=(pauseit==0)? copyspeed: 0$ H8 W2 A- A. J7 E( s5 S
var iedom=document.all||document.getElementById& ?9 \0 }  N6 I9 ~' v
if (iedom)' W* T2 l' Y: `9 l9 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! B+ Y2 Q/ }9 @, R1 Z1 k% C
var actualwidth=''/ N0 V4 ^+ R! M2 q' x3 X8 H* m
var cross_marquee, ns_marquee1 L6 I' D/ z" V) r5 O1 `" o' v
# C1 }/ q7 \- a9 H, {% ]
function populate(){
( Z* n9 W* T: B+ x4 O0 l" Z0 qif (iedom){
& @& [# x5 l' R- e# r' ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 i  e/ B+ Y5 C* i& B: V5 y" w$ Dcross_marquee.style.left=marqueewidth+8
* U! T% t3 l8 `2 ycross_marquee.innerHTML=marqueecontent
$ H2 p. w$ `; Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. B4 s0 S& I% [7 A}
% u! Y9 S9 t$ O. ~4 d; Qelse if (document.layers){
- e% ]1 }9 V1 e; ~; @* G( tns_marquee=document.ns_marquee.document.ns_marquee21 Z. m$ `1 s$ @7 }( y
ns_marquee.left=marqueewidth+8
- K( a) }  q; H2 T7 V' wns_marquee.document.write(marqueecontent)5 Q1 a# Z! r3 k2 e
ns_marquee.document.close()7 a6 Y. [! _/ a9 r' V8 U
actualwidth=ns_marquee.document.width
/ G2 I0 z, Z2 x( X/ E. s}
. N) i) [6 e2 V9 P+ Y; G" ulefttime=setInterval("scrollmarquee()",20)  V) C" N* ?4 x- {. T% a
}9 |8 M& o& l9 a, B1 o9 D
window.onload=populate' f  h, P+ o: ^; q2 y' e
) d! y4 @! j# ?: y+ W- x, W4 ]$ q
function scrollmarquee(){* E* t, y# p' J3 S- C' @5 R' _
if (iedom){
/ D' b: ?* `6 M3 s7 A* Q! C9 Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" |5 N9 n6 P! [$ P' r7 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 s. i) x+ n/ D  |8 l. @
else. x3 v2 k! n! V+ [
cross_marquee.style.left=marqueewidth+8- i5 L% {# Y  W0 ?/ c3 X8 V0 ~
6 [* X" _7 t/ g8 }7 D! Q$ _$ t! `
}
% ]3 |* a4 u# x1 Z* ]& Y2 Eelse if (document.layers){& x9 I# X: r& a4 z/ |& a5 S1 R# ^
if (ns_marquee.left>(actualwidth*(-1)+8))
0 F8 G3 T- V8 q' Q2 P$ Rns_marquee.left-=copyspeed+ W; I. H" {7 ^# I" }3 r! I: c& |' K
else7 O" ?/ [6 U9 l0 h
ns_marquee.left=marqueewidth+8
+ T+ {: |7 c/ C) M5 x}
. B2 E( V' ]0 s" h3 E}
1 G" W: o6 o3 g+ z6 E4 k+ d, r
9 J  ?% T' `  O& vif (iedom||document.layers){
9 E  _) X7 M5 y3 h+ k0 F1 Jwith (document){
% ^1 Q' N0 B% Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; R1 Y& H9 X9 o0 I* t! }& pif (iedom){
# B& T/ I6 c8 U! k8 m' s& Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- [6 f8 D" V2 i- T7 F+ n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 D0 t# i* M; Q/ \# }/ iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( }: p3 |/ u1 Z" ~2 n
write('</div>')
3 N- K6 |, y( E5 F/ a" H* p7 {}$ c5 q% i6 ~+ s. u. s; y. Z
else if (document.layers){* d; _& ^% g0 g1 ?% X6 Z$ W  H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ^7 H+ ~. K: i) c$ G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. ^- W+ G4 ^: z2 {( w; @% xwrite('</ilayer>')$ p. v& P3 i- L5 V' \
}
' F) ^+ f: r) e( I) d; f( [document.write('</td></table>')- X% `  [3 k# m
}
' ?& L, H' P4 s: q) {8 w* W0 ~}
) Q/ S0 n$ Z5 X& s</script>

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