返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ n4 x7 A* w% ~, I& J: [
var marqueewidth=300( j" C, B, y( k( O8 Z, J! |8 \
//高度
3 Y: P- n3 h: e8 L3 u: evar marqueeheight=25
1 H9 n6 h7 ]6 n* D' L7 y//速度(1-10)1 ~& f' |& ]5 z9 z; n
var marqueespeed=3
/ ^% Y3 Z! N) K* b//背景颜色3 O) k" W: t: h2 d, `) J
var marqueebgcolor="#FFFFFF"
& w2 W! t4 A) ~8 P) M//是否能暂停 (0=no. 1=yes)?+ V: p5 N( j4 |! U
var pauseit=1* l1 d$ V5 E( g3 P  t) e+ l" }$ o
' @5 a; A4 g9 d9 ?  d- F
//修改显示内容4 d' S" P. ^( ^, X/ D% i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 Z6 T6 |  l8 U( J% ?% D9 k, I* T2 s  P0 _" ?
3 l# F4 J; d; i9 L2 r  S8 D
////下面不需改变////////////
1 \2 p6 O$ D% V: T6 n) {% L3 a! P
var copyspeed=marqueespeed
" h, Y9 O; O. Y3 kvar pausespeed=(pauseit==0)? copyspeed: 0, o. x7 T, l8 X- _8 ]& O
var iedom=document.all||document.getElementById
; {8 l3 [/ Y9 y) }- B) r4 Dif (iedom)
' a4 R* X/ y% P2 V# T0 I. Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* j7 p/ f' c/ U+ Svar actualwidth=''( k! K* h: [5 d. P7 m! n9 ?
var cross_marquee, ns_marquee' g5 M# |) G* ?; C( m* |$ N
: r' [" _, X/ L2 U1 Y
function populate(){6 z: }+ c8 g% G) Y
if (iedom){8 v6 h; {7 X$ V- m" y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  M5 N( ^- n) Ecross_marquee.style.left=marqueewidth+81 R6 m% v+ E& D2 L! W
cross_marquee.innerHTML=marqueecontent
4 b, l$ X: j, }0 g, N' }: ^$ c, Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- L' Y/ U* ^8 I0 w0 L9 G7 ]/ \1 T- |
}5 M) ]4 i4 C1 i; o4 U) n
else if (document.layers){! G* a: t# q0 z3 F/ U' R) K
ns_marquee=document.ns_marquee.document.ns_marquee2
/ Y( l8 W4 ]8 ^  Sns_marquee.left=marqueewidth+8! l+ k* n  l2 s
ns_marquee.document.write(marqueecontent)
' w1 ]- p, E3 ^! I6 E4 c4 Ans_marquee.document.close()' u# k! L/ n8 V% t
actualwidth=ns_marquee.document.width$ D$ d) x2 J$ j" q7 V" F
}
, A7 ^9 E: R9 \' S$ Nlefttime=setInterval("scrollmarquee()",20)
6 b% J& W. A# ^, v6 m. R}
  }7 V" g. Q; L2 C1 T, ~window.onload=populate" u6 [! I; U, N2 |9 w/ }$ ?

' R6 G8 h7 o! S) `% D; ~! |function scrollmarquee(){; x. K$ N8 f* S$ [1 O1 [
if (iedom){$ {/ N# o+ Y$ ]" {4 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' P# e! E6 k. \7 l+ n. W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% ]5 [$ o1 x; }' ?3 ~else
; f5 b$ {3 m% j" k9 I7 {$ Y' Ecross_marquee.style.left=marqueewidth+8, H7 O6 K0 R4 x

9 Y4 M% S4 e& l, O, T  V$ k}' H9 l5 j" [5 \9 v2 w2 b
else if (document.layers){! n5 U2 E# n: u( \
if (ns_marquee.left>(actualwidth*(-1)+8))
: d& O& U) d, q0 B& y: `9 Cns_marquee.left-=copyspeed
5 ]- V1 X- V! U- {' F# D  _9 Gelse! P4 g8 U6 \5 ]3 M% v" {' U
ns_marquee.left=marqueewidth+85 |' \2 s$ k# ^7 o
}
* R3 q) ]/ T, B' o. C$ F' x6 j}% A" U, Q6 f. C) _
4 L% [  l' V& ~: u) q7 S# [' J
if (iedom||document.layers){5 _2 i  O5 W5 l0 T8 E
with (document){
7 Y. A7 x" o: H1 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- F0 I) u; ?/ E8 f( d- s9 U; wif (iedom){
/ |. Z. ?, ?& U" B5 pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ A8 W- |. V; Y, f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ k! q' P, I6 }" W: k, H" M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ E* p6 k( u3 N5 i! u+ Y1 W3 }( Wwrite('</div>')7 B1 T) k; y1 u* E! A; a
}
) w  j3 l9 O* Z2 A4 ?" ielse if (document.layers){
) @/ |7 W% J' Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* Z8 Z6 p$ k+ H+ v, x9 \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# v9 y4 N& Y" V' s* Q  Xwrite('</ilayer>')
. |/ s# |8 L: Z9 t! `1 F; [* ?, F}
& n: [2 @$ P! V1 qdocument.write('</td></table>')1 l  Y- [% z! x: {
}/ N4 e8 _4 R7 e& i+ T
}# [. I5 g5 F+ H( P; W
</script>

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