返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ @) g5 v  H. ]& Y4 uvar marqueewidth=300
3 j1 q# V& ]  a, p- U9 X+ S7 s//高度
1 n; m! X! {0 O* C7 b  j: dvar marqueeheight=25
% [/ i) Z+ ~, T' A& T//速度(1-10)  w# R! U% ~0 d7 d- {& |
var marqueespeed=3
9 r, Y4 V3 W) l' f8 _0 m//背景颜色5 E; b4 S  l2 ]- o1 w# _
var marqueebgcolor="#FFFFFF"
* c8 b& S# t5 P/ ]' Y" M  x//是否能暂停 (0=no. 1=yes)?7 w" }5 x2 X. L3 t9 T
var pauseit=10 t, O9 ~) K+ f# D8 a

# `- ~  [! S/ m& g2 ?/ _, @//修改显示内容
9 ]8 H7 D! P+ ~2 g# _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 B4 @! u7 I6 w. K
. a" B3 U4 k- k9 g4 Y% b4 f
  a# j4 @7 k8 }6 K( o/ K
////下面不需改变////////////
( x! G: [) z# Q. Q% @# k& l/ W5 ~7 k
var copyspeed=marqueespeed
+ t0 m, `4 ^0 S1 S: P5 L9 [var pausespeed=(pauseit==0)? copyspeed: 0# ^' R2 t1 x: p$ f1 E9 d) h4 O
var iedom=document.all||document.getElementById7 O8 {+ F- V4 P; Y; f" y
if (iedom)8 [/ }* `  l5 ~% [: `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 {7 T& B: o7 c, t7 q2 lvar actualwidth=''; l* J% Z8 ]; `  d) Q  w" n
var cross_marquee, ns_marquee& Y7 r4 E7 d! p- D% s

; O1 y/ X$ N$ Y9 k1 {* \: l) |function populate(){
- G6 v4 S& E3 }+ mif (iedom){
) a" ^$ l& K" E8 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 E. b! K1 X! p/ P  K9 jcross_marquee.style.left=marqueewidth+8
/ C) b; b" i2 R% m  g  Tcross_marquee.innerHTML=marqueecontent
4 B8 i% W/ O1 z( {% ^. qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; s/ Q# C9 }1 G" H: b( _0 m
}
8 h: H" g8 b7 _4 L) w0 {$ s* Helse if (document.layers){4 R! I! U# q( r& W$ q1 Q
ns_marquee=document.ns_marquee.document.ns_marquee2
; _' E+ d& h0 _) V" rns_marquee.left=marqueewidth+8
$ i' g* ~' I2 M; Kns_marquee.document.write(marqueecontent)! w7 n8 g' G8 h4 F
ns_marquee.document.close()( N' d9 Q/ k* _( ^
actualwidth=ns_marquee.document.width
) X+ Z. `* o) Y7 g4 e}
3 _! S/ Z' i4 O5 Mlefttime=setInterval("scrollmarquee()",20)7 C! U. d& W1 n; u0 k
}* G. k- \; k! z+ l4 }
window.onload=populate" v- ?2 k0 G2 t. G# O' G# e

" r4 r2 q% g" U. \, Hfunction scrollmarquee(){
$ f+ [1 l) R  S1 h( \: z1 eif (iedom){  ]3 Z, F! E3 j3 g1 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 x' e( j5 n0 _9 R# k" h: v+ s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, k) r) S$ h, w  ]4 m
else5 B2 O# Z( J* T9 u7 M. ^
cross_marquee.style.left=marqueewidth+8' o+ [2 l1 G, p9 n# F
( o: D* z& w, J% |! ?
}9 p  g4 `- r% j. J" M
else if (document.layers){- ?/ j/ r% `- p
if (ns_marquee.left>(actualwidth*(-1)+8))2 y3 H4 s+ Q' T, q' f5 b7 N) I0 w
ns_marquee.left-=copyspeed/ j  g3 C5 ?; V9 {" s% r5 c% T6 |
else0 g6 v9 ~7 G# R
ns_marquee.left=marqueewidth+8
: ]+ p6 V3 y7 E/ t% x9 E" z5 a}
8 p( G8 _. H# q9 |- n" r' H}+ [& G/ t( Q  K% _' l

% P. B3 z5 `; b7 T: ]* C; K8 vif (iedom||document.layers){# z8 w6 M- U$ L' U9 R& i
with (document){
8 q9 i" }/ l8 m; T/ ]; ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 B. _8 o. g  Z0 R3 oif (iedom){6 Q& ^9 u: ^' \3 T" ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" f* f; {& i/ `4 _6 ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, K( ]4 l7 \% swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. f9 x6 e# H3 m  R1 `% V  jwrite('</div>')7 |' U& d. n0 T5 W! H0 t) c5 B
}9 j, Q) h" h- b- G) Z' z
else if (document.layers){1 o" L+ B6 i  \/ ^1 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% A* O& E& v7 W% [% zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): v# Q; n% j$ r4 U3 ]& ?+ L
write('</ilayer>')0 G' Q9 N. r1 I2 G- G
}
& |3 d$ w7 p3 Y) _; adocument.write('</td></table>')
1 o7 F# h: \! E! t" w' F}+ d3 H. H4 \) r6 n* X) V
}% X$ a- i9 I/ R; S- t' P- L
</script>

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