返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 v( a/ J: x0 ?var marqueewidth=300
8 n2 U! }, W1 A! P  B- O+ U, o) D//高度: u6 M( y: f; ^  ?4 S! J: u' J
var marqueeheight=25
' ^' o. H0 O8 N1 d& n' S//速度(1-10)& u7 i* R: s) k" @1 G' i) L
var marqueespeed=39 {; Z1 x. J+ G4 n
//背景颜色
) N) G* `9 f" y9 ~+ n" g5 nvar marqueebgcolor="#FFFFFF"
  ?. j$ d. A9 _' M//是否能暂停 (0=no. 1=yes)?' s" |) ~2 c7 A% w$ c, r
var pauseit=1
5 x6 N1 W- J. T9 c# q% A! Q8 _9 @/ P/ ^3 v
//修改显示内容' B6 e7 I, w2 I& T% v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ T/ e5 T1 l# L8 i* e0 T) Z
; `" {7 f' X% f, B. k1 K

* T* b* F( g4 \& S////下面不需改变////////////
; j. H+ s$ F$ E7 @1 G
! m5 P% D8 i, [var copyspeed=marqueespeed9 R% B1 I8 V/ U, ~
var pausespeed=(pauseit==0)? copyspeed: 0. @/ f7 F  S2 w/ S! F2 D) h
var iedom=document.all||document.getElementById
' M7 P$ d0 b+ Tif (iedom)
) h, o# a- r/ jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 r1 T) G9 I# a& tvar actualwidth=''" X) Z% T9 H* \. b4 g
var cross_marquee, ns_marquee% k# d* u, _+ z/ V' i

- H6 i' x& |$ Ffunction populate(){
& D! a: d, K% i$ xif (iedom){
7 M% [. o& v) r) X" P$ ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 l& @' U! |$ P% b0 l' Q! F9 l6 ]1 W# k
cross_marquee.style.left=marqueewidth+8* v  Q3 Y' s0 U2 ~: R% S
cross_marquee.innerHTML=marqueecontent( t# I0 L% V. E" b9 D& \2 G2 `# S+ ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 a+ w2 `$ ^9 o. t}
2 K. m  Z2 ^- A: W6 v$ e$ Relse if (document.layers){' t! g0 }( [4 [0 C; h( Q2 ^
ns_marquee=document.ns_marquee.document.ns_marquee2# q( M( Y1 x3 ]) M+ G* T8 S1 i3 `8 Y
ns_marquee.left=marqueewidth+8
- d7 |  H" o  Q+ P  \5 n% k2 b  u, Qns_marquee.document.write(marqueecontent): B5 e' W0 T9 I. ^
ns_marquee.document.close()
* X5 q: i0 t' |; cactualwidth=ns_marquee.document.width, A# ~  x! u2 l% R: i
}9 q" z4 ]' |" F9 Z. e
lefttime=setInterval("scrollmarquee()",20)- v# R3 x. Y% w# Z6 {9 X9 n
}% h5 P% R4 R: C3 ?2 X3 K9 b
window.onload=populate
+ Z! V$ z  G: C" u
' A$ b: _  D' Qfunction scrollmarquee(){4 M" ]# g( e! n2 G/ R2 S% |
if (iedom){
# G  K6 C  T! ?( Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' }% H* z* P$ R* i3 w, D. C  J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 B" p; E( X" K) p8 h
else9 f) k9 y* \: U7 f! G; V- Q- N8 d  O, {
cross_marquee.style.left=marqueewidth+8( a" ]0 f. E& @# O
4 u3 @' w9 g: h8 ~7 L
}9 q% V3 w& w- \* c
else if (document.layers){* N% j# a1 i3 @2 {
if (ns_marquee.left>(actualwidth*(-1)+8))
5 y4 E5 H0 T4 ?& H! ]' W0 ]1 q9 M2 wns_marquee.left-=copyspeed
; n; j/ A% O3 Q* f1 `7 F: xelse
! G. C# ]# C# p9 Tns_marquee.left=marqueewidth+8
" F$ p! l7 e4 H) k: p4 `}5 F2 x8 c2 ?6 X" |5 ~  r
}3 Z: x3 K: i' e! Q  @: L( V9 V
: v" v9 e& p5 }- b4 m# ^& y
if (iedom||document.layers){- N5 M. k' v+ _( D7 Q3 e' P5 o' R
with (document){
5 r' Z( I( s0 g& wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 M; A2 A2 r9 X9 z4 D9 `  r( `if (iedom){
9 ?1 [- {# [* f: S+ C6 N+ s# Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); s" h) u0 D# I2 x8 H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ C$ I. O! o8 y: T: }$ ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 ?1 \5 U$ [; B" `8 A8 Fwrite('</div>')& w; D  C# Y8 @
}3 }+ v( u% P8 t# Y. p" N+ {
else if (document.layers){
6 e3 G, t: j2 _1 [% ]1 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" \+ Y/ I5 J+ v$ _9 ?' G* c; Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! a; I! q/ a+ Z6 O
write('</ilayer>')
* a+ z* a8 x: i0 @. h; v, {1 L' B}: Q. w" y/ o% Q6 e& w) e' {
document.write('</td></table>')! y- k4 |9 @  t$ `) `
}
+ V7 U% ~9 @, Q5 [1 i2 r}
8 Y5 b# O4 k- z4 W2 V! a</script>

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