返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 @/ C( ~$ r- l! }; r" p/ J/ b' h0 n
var marqueewidth=300+ |% ^+ `. ]. B+ p9 a8 G8 A1 Q
//高度
" p! ]& p/ D. h: [8 pvar marqueeheight=25
/ J- J: e# D  d# U: I//速度(1-10)
, {9 d9 x7 A; \2 Z" `; ivar marqueespeed=3
4 F+ O7 o: S8 R" h, e//背景颜色. `, g$ g0 e* @0 ]& X- ]
var marqueebgcolor="#FFFFFF"
- I, T; y3 n, H4 v8 t! _//是否能暂停 (0=no. 1=yes)?
& b  i9 M* j9 R. M- `* Avar pauseit=1
7 n( w1 Q% X& a( t
0 f- [3 p' U! l//修改显示内容
+ I$ ~0 \% Q. e/ ^( mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 q5 D- X1 H# H& o* M) h& I
1 s: N+ W/ y# q" a; Q( p
7 Q( X. \  w1 ^6 G0 v- P1 O3 w7 g
////下面不需改变////////////& i3 U3 t3 _% V) F( @

6 a$ B: I5 U1 U1 _9 ovar copyspeed=marqueespeed3 c9 a4 W) d: y
var pausespeed=(pauseit==0)? copyspeed: 0( B* Q& F. Q5 r1 n
var iedom=document.all||document.getElementById
' u, o. ?, ?, v3 K+ {" e. b" M% Jif (iedom)
1 n, x4 e2 z1 Y+ ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: N3 M' N- ~, jvar actualwidth=''
" J: P) Z: s6 g& H+ Z2 Xvar cross_marquee, ns_marquee
  Y) C0 g. m1 u. K
7 [6 Y7 K' u! k, o( Jfunction populate(){
- P+ M! a! T, K6 |  ^4 |$ fif (iedom){
+ V1 ]8 ]) s; L+ Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 a0 ^6 h9 J. M( l% Pcross_marquee.style.left=marqueewidth+8
3 b; R. v+ w1 T" Dcross_marquee.innerHTML=marqueecontent3 S  W& q% m) i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* v# D- T& J" ]" }. @}) z1 r6 y# U  X- Y. {! j  D; j
else if (document.layers){: W' W# T0 i, y. w9 f$ ?: T0 h
ns_marquee=document.ns_marquee.document.ns_marquee22 Y; B2 g0 A/ b, P3 P2 k# V2 \
ns_marquee.left=marqueewidth+8
0 R: U' T% X, Pns_marquee.document.write(marqueecontent)2 p: [! ^0 ?; D
ns_marquee.document.close()
) b# M7 X& K% T, [! Vactualwidth=ns_marquee.document.width
" a: x1 C+ z# K  G- ]2 A2 b. k8 c, f2 ?}
( ~% |( g( `3 H4 }+ zlefttime=setInterval("scrollmarquee()",20)1 J- E, ?- g8 q; p+ _, ]
}8 G( ]: M# @: l/ a- {/ @3 |# L  K
window.onload=populate
3 v/ f' X9 ~1 h( R/ P9 X2 o+ Y7 I% Z0 Y% f- M) N
function scrollmarquee(){, Z; z/ T# Z9 c7 ^
if (iedom){
9 v) |7 j: B' g, t; Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" H0 u9 R" P% i: E, d( zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* ~: I& o; H7 ^: u2 H5 A
else# U  l* S  d3 R& O
cross_marquee.style.left=marqueewidth+8
1 e, A" ^* r9 N6 s0 {( Y. D8 a( V% ?% x# k7 L
}
+ b# S; F+ Q+ ]: ]9 qelse if (document.layers){" e$ R- U2 ^0 B+ f7 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
# M0 s2 [7 V! @; Hns_marquee.left-=copyspeed  A, {2 T6 _( l! x; r7 w' ?
else" |$ |$ S: D# q
ns_marquee.left=marqueewidth+8$ T0 O& @! `0 c. W2 Y
}
! P6 ]/ C, }3 b) o9 S% [}1 A8 W5 [0 y; ]5 b
2 }( V+ y8 s* K1 A# z
if (iedom||document.layers){- m4 f% z" ^+ n4 i5 v
with (document){  o5 K/ q# l7 t% c/ ~
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 \6 n3 P, V8 D  p$ V, E
if (iedom){
0 }2 M, E4 Q& V8 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 |# \7 N" E- ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 L* z7 E0 N' W# E* a7 y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 |. J& p' E  Q
write('</div>')
5 h  ~& @# F& A1 j8 P/ Z7 G# ?}" ^/ T( z. F: U: ]6 w
else if (document.layers){  ~2 i# o. K4 v' P9 D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 u6 v6 G% t0 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 r$ c4 ~/ T4 a  Pwrite('</ilayer>')* J$ ^# m5 \& C) C
}
3 J3 e$ n) h! _- \8 Vdocument.write('</td></table>')
9 S- p1 Y! s$ b, |+ v}+ d! z# R3 p0 c
}/ C( w4 w$ T# q" b+ j9 ?4 w8 a
</script>

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