返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 P/ ]7 ^7 ?# `+ }5 Svar marqueewidth=300! ^; v$ f8 ?; V2 u5 P1 R; ^
//高度
% U- r0 W8 Z! s  n% p& Avar marqueeheight=25
" F3 k2 C& M( ^3 h9 Z7 M6 ?8 V7 A//速度(1-10)) t. y( }, m: f: J+ w
var marqueespeed=3
% |) V$ j) m- R, a# q//背景颜色; c/ C" V  V% @) W& T5 x; {  v
var marqueebgcolor="#FFFFFF"
# @/ I1 ]1 S% d9 S$ u) T0 Z" U' X//是否能暂停 (0=no. 1=yes)?* ?- ]* b+ V$ [8 x+ b3 ^: \: D
var pauseit=1
- P/ C* K# w7 M
( c- [9 r6 J  Z9 t$ Z; D//修改显示内容
% ~! Q0 i+ y; C' ^& Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( E# ]! {' W1 h; e2 W) b8 x% i2 q7 j9 A; z9 J/ b
( y- X; K% K1 k4 I  f
////下面不需改变////////////
  u" x- K2 u( u( k! ^# Y( L3 S) ?3 k9 F8 C3 l: r- q' H7 g
var copyspeed=marqueespeed6 \7 G$ M3 X6 ^2 |
var pausespeed=(pauseit==0)? copyspeed: 0! Q  ]9 U5 B6 S/ |
var iedom=document.all||document.getElementById5 x% s, g; J& J' O: n6 J3 x+ h2 k
if (iedom)
' t9 Z+ |: F6 D# Z& kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ K2 K( r0 S/ f# O, ?var actualwidth=''
) r( B. c! R3 w/ s* O. K& k. F& ovar cross_marquee, ns_marquee6 m; @2 {8 ]3 \. C3 ^! |+ E+ P
1 G  Y! ?. G/ c; _: M# m% p3 x
function populate(){) k- ~0 W# Z- |, N9 H; C" c
if (iedom){; w$ a) a5 A6 q8 }% k0 b1 {: r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 V5 t% a" ?3 pcross_marquee.style.left=marqueewidth+8+ ^- q4 M3 B/ z
cross_marquee.innerHTML=marqueecontent2 x2 s" \2 u% w. G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& D; u6 Z, A+ N& x$ j! n
}! e3 n# Z0 `/ g# K: H
else if (document.layers){
+ b! |6 C/ X: D# U2 dns_marquee=document.ns_marquee.document.ns_marquee2
" i* x7 j! Y( W' A, |ns_marquee.left=marqueewidth+8
0 V8 P( l  x' ]  ins_marquee.document.write(marqueecontent)
) |9 Y7 x; B6 s7 ^! z, Uns_marquee.document.close()- k8 ]7 l+ m4 V! b9 d
actualwidth=ns_marquee.document.width
& [* ^0 Y" T2 v) O- N}
& k% b3 [. A6 P- b6 \; Blefttime=setInterval("scrollmarquee()",20)4 ]! v8 D* i) b( b
}$ N# s* ]3 |4 ~( r! s
window.onload=populate. r$ a8 F3 |, ?4 Y" {# C; y
1 S0 k" R( `/ e" j( p4 S
function scrollmarquee(){
* `/ r3 z7 P0 uif (iedom){
! L3 U% |0 q0 c- m) o* _4 H; S- m0 Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 K, M- r. Y/ C* K. z' j% `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: Z. Q) R2 x) o" uelse- C5 M+ K) f2 n, H$ p
cross_marquee.style.left=marqueewidth+8
' a5 P& S5 Y: l# L
0 N. P! ^! l! ?4 Y" E- l" \}' {% F8 ?/ N* V/ F* S8 i( h
else if (document.layers){
( _- _4 }3 F/ d# O2 c, Qif (ns_marquee.left>(actualwidth*(-1)+8))
- ]9 H5 Q7 _8 s! Z) }. Y4 w5 A, T: [ns_marquee.left-=copyspeed
- j( P. b( Q" Z: D8 X7 ?else; U8 Q% y& g+ o4 k
ns_marquee.left=marqueewidth+81 J* _5 |( u0 E' I( v( p& H
}/ s9 n2 x2 f/ a2 j# q1 b
}! P0 P4 e8 _( b! \# k1 v. }

& C% z) q$ H$ L+ s! yif (iedom||document.layers){
0 K! o2 B9 |# e1 D; Jwith (document){
, n- w# V3 t% q! Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 z7 R* R4 K6 V% {4 Bif (iedom){  F5 n! j* C& h( s& R; g+ e1 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# Q  _8 ?9 f, g( _6 E4 C; m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" m, w9 z6 P! b* B* u  nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" c9 `! Q5 P9 T. O& {" q4 r6 Lwrite('</div>'): t) o9 M9 y, E3 Q  R
}- C3 h6 i5 y: `( x; S
else if (document.layers){
0 j8 p( ?/ c6 g4 W* i: e- xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ F8 |  Y. u7 D+ Q( H. W2 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 O% l; m" X' ^" b/ M: h
write('</ilayer>')
0 }* ?. ^; p  b1 N3 W" y0 e3 _' R}) P% d/ N! e9 }
document.write('</td></table>')
6 v: ?$ n" _6 Y: k. `" ~}0 b1 J2 Q$ v* D/ @3 o" w
}
7 u$ O( B4 ~& b6 b  h</script>

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