返回列表 发帖

网页之跑马灯文字特效

//修改宽度" i. f4 w, }1 Z: s, P6 u+ ?+ _
var marqueewidth=300* l' P6 J  Q* J. ]2 Y
//高度
2 l. c! Z, u# ^7 `9 n9 _, ^, xvar marqueeheight=251 V6 l2 z% G! y. m" Q
//速度(1-10)
" J& o1 y$ G5 {var marqueespeed=3
" U* |* j6 @3 U/ m" J: v0 V) Z9 a4 @//背景颜色7 Z- k* A1 h$ C7 K$ b( B. C
var marqueebgcolor="#FFFFFF"# k3 J" o5 v2 h4 j2 p
//是否能暂停 (0=no. 1=yes)?  ^, K* G& f6 X7 w
var pauseit=1' F- V5 S  A" i8 O5 [/ Q
; a. T( |$ D" h  B* Y
//修改显示内容& v* w; d. F7 M4 O! L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; C, M# G; M, d5 P
+ O- _( D5 A/ ~1 t+ e+ Y! z( m

$ J7 `) y$ g# e# w* f////下面不需改变////////////! w  J* ^  F; g
9 x& g% |2 z" B7 R( q3 y
var copyspeed=marqueespeed9 L+ N$ b8 N: d" p
var pausespeed=(pauseit==0)? copyspeed: 0
8 A+ l7 I" i1 X9 u& ?. Zvar iedom=document.all||document.getElementById( p, s# x* d5 h1 d/ z" B
if (iedom)
- J5 u! o$ U) f2 W  W& {  k) Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- U/ x0 o; Y# I( E  _! I
var actualwidth='') `) o3 E; Z. C! G* b( R; x
var cross_marquee, ns_marquee
& }2 G# a6 I9 k$ B- [2 h( C! P; s5 H- e
function populate(){
: J3 @2 V" a& g* P) o; z* A' e* Nif (iedom){; j. Q$ K+ r' p& x' q  ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 a0 n' j. @' k2 m) [
cross_marquee.style.left=marqueewidth+8, G# J# `1 v: G* _# k5 A( o9 {, n
cross_marquee.innerHTML=marqueecontent
* h7 }7 H! F* h; Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& }3 m; x/ B3 O4 D8 j; C
}8 D) @& G( D8 m/ c& Y* c0 S
else if (document.layers){' f: n& w) u. n8 u. ]6 i
ns_marquee=document.ns_marquee.document.ns_marquee2+ y0 a# ]( K2 o( x6 \
ns_marquee.left=marqueewidth+8
) A( d$ B7 }6 i  ]4 s) K$ i7 a' f4 ~ns_marquee.document.write(marqueecontent)3 d* a# Q; d5 e8 ?* \4 j) v# z
ns_marquee.document.close()! m- r- ^/ b( ^* h; N$ F2 H
actualwidth=ns_marquee.document.width
1 B2 a9 V) E# R9 `# T}
. t% |# u% V5 z: o" Blefttime=setInterval("scrollmarquee()",20)
, J& L* Y0 N( s' L}
( b; n! x4 t7 p8 Q* W6 mwindow.onload=populate0 F/ h% E' u; M4 [* o. R8 V0 B  C
4 o4 U$ w1 r  R: y
function scrollmarquee(){! {$ P/ E$ ~! G5 _. L3 R% ]6 r) o
if (iedom){
0 v/ ~( S* ?. Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 c. l  Q0 _4 o6 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* s4 K2 j& s3 Y# o1 velse
9 k/ }) |6 m2 M$ m' l' Across_marquee.style.left=marqueewidth+88 N* d0 x% P, ]+ X0 W! h

. R, P6 b: \& w# G}8 H' c" H8 k0 d7 A2 o+ x+ e9 M$ T
else if (document.layers){, F% \# E9 P2 i& \
if (ns_marquee.left>(actualwidth*(-1)+8))
8 n- q+ S& p4 @7 O& q+ c3 k* _$ Mns_marquee.left-=copyspeed+ x1 N: s& [7 J( Z
else; C% D2 r/ _! y1 a/ l
ns_marquee.left=marqueewidth+86 }" J, ^8 a3 h' x" V7 Q
}  h% h9 _# v4 @9 k/ \- O1 K
}7 z, Z4 n) K7 B  `4 q

9 }8 |' d1 E* v# H# {% Y3 fif (iedom||document.layers){+ O( Q2 N8 c6 U7 W
with (document){
, m* w3 ?& k5 s. Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- h- G5 H# r) H7 M7 i/ K9 J" _if (iedom){
7 C+ v. d9 r, W; Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 ^% K3 V6 K9 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& }& [7 g/ U7 }- M& }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! z. d# a0 f3 j- `; W
write('</div>'). E1 x0 B9 j- O1 ?, i  U
}
- }* p  L' a" G6 Relse if (document.layers){
4 Y5 \% S0 f' j) m& J2 mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% a0 N' {  k# D! L9 C& l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 }9 i% k6 S+ Z6 ^write('</ilayer>')* z7 N5 G% K; Z3 S: F2 e
}7 C6 G3 v5 i- y& @1 B4 d
document.write('</td></table>')
3 n3 v; O/ d3 ?5 b% ], Z, v}
9 a0 c9 H+ ~4 a}
3 A! l/ G! F1 K  E( l1 A</script>

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