返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; m. b; T* S5 Z, d1 ^. b* |var marqueewidth=300
0 V. G+ B0 R& Y: `4 o//高度9 Z3 @* @$ o4 V) ]8 d
var marqueeheight=25
4 b0 V/ U( I6 C0 t//速度(1-10)  f( R& i$ i% y) I, Z( ~
var marqueespeed=3
% E5 \+ J# m  {5 F' W0 c//背景颜色. b9 N' O  k- y7 M( l0 I. x  L! U
var marqueebgcolor="#FFFFFF"2 h+ `% D% F; p; s* M4 ]
//是否能暂停 (0=no. 1=yes)?' K4 a+ x& E, w5 o+ L' [: a
var pauseit=1
+ z# D* M0 D# R/ S3 }
9 {6 ?; @0 J" u//修改显示内容
- X' Y  {* P4 Y+ Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 k$ P1 _/ D  X# C

: D0 @# ]! W; f6 H1 ?$ L: j
/ t6 @; }3 M8 A7 j" ^////下面不需改变////////////
& \, e. @& G7 h* f- g& |1 E. D) \. }# d" C1 y+ }, J
var copyspeed=marqueespeed' g, g8 v8 n: W* m- }' j/ Y
var pausespeed=(pauseit==0)? copyspeed: 0
! U3 `" M: U# avar iedom=document.all||document.getElementById
! K% b- F3 r' n' T4 b4 p+ l, R. Lif (iedom)$ p' l7 z  `( t( B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" Z6 G1 h: I5 b" Svar actualwidth=''  |% Y4 f3 y! f6 z  `5 y$ J
var cross_marquee, ns_marquee. |9 B+ D8 r* j- L: c
$ \: }/ t) f7 ~+ R! R( \
function populate(){, [6 T' D7 }7 e  V/ W
if (iedom){3 P9 z, F/ L" o1 `7 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ R- Y/ s1 P  G; ~  e( j' S
cross_marquee.style.left=marqueewidth+84 y. ?4 }5 m* @
cross_marquee.innerHTML=marqueecontent
' ^7 f1 ~$ w: E* {3 i: q6 X; oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- J5 o2 ~: n6 o! q}
% `7 O" }4 p$ z( R0 y/ m  p# T" U; `# O* felse if (document.layers){7 B' w5 W/ |9 E7 [8 q" y* U
ns_marquee=document.ns_marquee.document.ns_marquee2
/ _( e. h0 c, a$ k" @' ~2 qns_marquee.left=marqueewidth+84 b9 e( j, ?: e6 D( T
ns_marquee.document.write(marqueecontent)* w' M8 R$ c% m! U4 c/ G% e
ns_marquee.document.close()
: F5 A2 D# m/ Kactualwidth=ns_marquee.document.width# R; A' L! c4 _6 O
}
6 j+ x6 |+ r7 f; G9 G* a$ \lefttime=setInterval("scrollmarquee()",20)
! Q" R; s! @( p7 F, V}- s3 ~: `) X* L4 K2 T+ K
window.onload=populate, l% ^5 D# G! a; o- P& R6 n

1 v) N7 U) T' ]. L- s  Ifunction scrollmarquee(){) a" p" {5 B( `1 d3 p
if (iedom){# s. O( w& |' k; Z; j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  `+ G7 k! \' @* }; \% p5 fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" z; f$ i, |  \  e1 K$ ^else
+ i6 @8 |# e2 D8 A4 Hcross_marquee.style.left=marqueewidth+8
5 g: `. |' w: ^
# p9 E" ]0 T2 n}
6 ^6 o# B- l& j2 l& T: Helse if (document.layers){
. D8 s4 B' S! T+ o, u4 Q4 lif (ns_marquee.left>(actualwidth*(-1)+8))
/ f- i/ o7 m) ~; _ns_marquee.left-=copyspeed7 K" C$ }8 X# C; q
else
- J) \4 }5 }  n  `  }8 Fns_marquee.left=marqueewidth+8
  `8 G9 R% Q7 R5 z  P5 Q' ^}+ J6 ?3 p1 U/ y, \* p
}
! f: o9 [% F: l6 C, P- T8 c- P
3 Z' X4 X/ C8 C* Q1 C1 @& @" Yif (iedom||document.layers){
, F! @5 V& F' ^9 G+ N% {6 d, [with (document){
) \& l/ J7 I3 t0 j- @5 rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' i' d; F8 E( g* Q5 H4 s  D. vif (iedom){
+ z( @9 B4 {( Q7 @& Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ f' p9 ?2 T0 z9 E% q  d+ \, Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, }+ f, g- S( t' b# d0 a' jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. {4 E. U  E2 G  v  }6 \: R$ Z& |write('</div>')$ v6 U: ~4 n' _7 r" s+ z
}
" Y% h% Z$ W& E) @, b$ Belse if (document.layers){
. o- W4 s3 F7 q. a! e( N0 l# Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ w8 D4 G3 L- h' Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 c1 x2 g$ F& f! e+ `; mwrite('</ilayer>'). T0 I3 w2 `( S
}& D* B! S% u- I1 u& X! m' {
document.write('</td></table>')
- i* ?9 O2 [+ W" h}
% C$ e0 G* N5 Y; v% m9 A}: v9 f3 T) t7 d. c& l" Y5 _+ l
</script>

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