返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( a- M  j/ @; K$ K7 svar marqueewidth=300
' B4 _  Z/ E) l3 ]4 H//高度; [3 I* x% C0 m' Q" |% h) U3 F
var marqueeheight=25) N" t7 P  E1 p) \. x) h
//速度(1-10)5 y/ [) m8 k4 q
var marqueespeed=36 y1 {, j- a0 Q: x& @5 J
//背景颜色8 o1 N- `6 p- ^, g3 A
var marqueebgcolor="#FFFFFF"
2 t7 t* r' A; U7 X! K# `//是否能暂停 (0=no. 1=yes)?
: }+ V6 P( ^: x1 a7 _/ v# vvar pauseit=1
% @' U7 L) [# U0 y
9 F+ W+ K; Q: _& b  f# P//修改显示内容. e2 r$ I1 L/ h5 F- f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 o: \3 X' u& D* |% V) y

' _- T5 c4 A: t6 p- a* ?, c8 D! ?& y
////下面不需改变////////////
: M; [) d3 L8 q3 L- B6 l8 G# a! P1 |' g+ {2 ?9 ~$ w
var copyspeed=marqueespeed
* {$ ~& \: f9 o  G3 j8 Z: [9 W- kvar pausespeed=(pauseit==0)? copyspeed: 0
9 v3 P) t7 T  l9 |. e, ^- ^var iedom=document.all||document.getElementById" \: p' x+ m4 ^
if (iedom)
$ s$ |! ]+ o, o( h+ ~) pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 J, H& u! P# ]var actualwidth=''- ?/ m8 y, j0 K* h- n: G$ n/ x" f: J
var cross_marquee, ns_marquee" I1 t" I3 `( \
- `8 d' m; F7 b& @
function populate(){5 i4 c% W% I5 i6 }0 R
if (iedom){
, _2 C1 T$ Y: `1 J8 Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 \; t* H  J1 S5 I# V0 icross_marquee.style.left=marqueewidth+8
7 @7 m& @" |4 M( H, v1 x4 R2 Tcross_marquee.innerHTML=marqueecontent4 ^* [! x' f5 K8 `" T: J) C$ j) ^* e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) M4 x. J) A5 s2 l
}( @4 u2 d- Q* X% a$ j
else if (document.layers){
4 a4 {9 j& W0 v0 ?5 |ns_marquee=document.ns_marquee.document.ns_marquee2( `$ ~( \+ N. A9 C8 u' A2 m
ns_marquee.left=marqueewidth+8/ u% O  v* R; R
ns_marquee.document.write(marqueecontent)
- Y' ^2 |& L! v& E& B, h5 Zns_marquee.document.close(): Z! `0 X! i% Q, e! \0 J; c& y" e
actualwidth=ns_marquee.document.width
) ]3 o3 J1 d( Q# z* w! ]}
2 @) T( }* X; M* E5 Elefttime=setInterval("scrollmarquee()",20)" y" F  K4 N" W9 p
}. K2 Z" r" h. |8 M( d. J8 s* `% m
window.onload=populate
6 Y, ~9 h2 z5 z' N! w# ^1 m
, ^# d& Q* \  `( x% [  v# ifunction scrollmarquee(){
& v% J/ N0 {9 \3 [1 Z8 _if (iedom){" ~  K  u9 Z) Z: M  p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" D. z$ F( t9 d* a* d$ d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# L) a7 V& R: a: [else" r7 N4 x: i# g
cross_marquee.style.left=marqueewidth+8
' U6 H- ]. |/ _: {8 q- T0 h% i- b' W
7 g+ m. g3 S' S& w9 ^$ u  W3 I/ T}
9 t% S" Z; _, A& Ielse if (document.layers){( _+ j( b4 q1 q8 `6 l
if (ns_marquee.left>(actualwidth*(-1)+8))
- {- ~: i9 I8 o+ j! Y& Hns_marquee.left-=copyspeed
  Q" S: Q8 m0 I% i! }/ X  p4 S# Melse
! E6 t/ n5 |7 N* wns_marquee.left=marqueewidth+84 g8 `8 Z. ]6 e6 N
}
; |5 b% H/ i+ [& r' e}
# D, e4 g2 |7 w
* T( q# r- a# X: g1 b+ t( N1 \if (iedom||document.layers){
2 ^0 y: C0 e1 dwith (document){
1 ]" K1 X( ?7 {7 M: odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, z3 @8 I  q; Y' Sif (iedom){9 x; b; |. k1 R0 R$ g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' U7 \5 F2 W* B# ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 p) U- |) w+ X+ C; d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 p! \' r8 t' _8 ~4 e) L
write('</div>')
% Z, ]' M6 c, J- d" Z8 V}# l' h# x- p" B/ q2 z
else if (document.layers){
0 A  y; n$ [: q; e2 X; l7 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 H% l; w5 Y5 e( m5 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 o8 E" |; b" g" H
write('</ilayer>')
: }' ~: w) I+ K}. J9 F6 A: n7 s) u% e9 h# W/ B
document.write('</td></table>')  n6 B/ b  D6 u' q: C9 ]* K, [
}
7 j$ o6 {# q, a' \% n}
" w: K% b0 O5 z  W6 a</script>

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