返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 p6 L; K, t' Q* P2 }var marqueewidth=300
8 f2 Y+ p8 \, X3 D//高度
0 m6 t+ ?2 K$ `* ?, R: h" ]% Dvar marqueeheight=250 V. F$ O0 H9 d: |
//速度(1-10)
1 ^, ]6 E7 f* evar marqueespeed=3
2 l9 G6 ^, H* m5 k2 l* O//背景颜色
( S/ P, \- t# K- I) o+ K6 [var marqueebgcolor="#FFFFFF"* _1 Q* ?6 M" c8 w2 ^
//是否能暂停 (0=no. 1=yes)?
& f# X# Y* f: B5 }: W) A8 t1 vvar pauseit=1' r" q# P$ \7 m4 a9 n

- d& A' v6 |% M0 b7 \% t) _( Z//修改显示内容
( H+ W2 J; u  D2 ?' V/ Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ D, g3 V% z3 M4 r" U* h3 ^+ }8 V! p8 n+ F  u! @* a# k! v* p

. ?. }, x' @) Z/ t* S/ i////下面不需改变////////////' \. _/ u$ r& q- H5 h4 l' f( Q
. ]2 {% Z1 F" Q$ `' N0 Z, r1 q6 h
var copyspeed=marqueespeed
, E" I5 s- ^6 bvar pausespeed=(pauseit==0)? copyspeed: 0
8 m$ }% W" E9 ovar iedom=document.all||document.getElementById3 |. [  u7 n  T0 |2 k- R2 W& n, B6 a
if (iedom)
! x7 u7 D- T# A9 t8 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& `+ o2 k! H2 M
var actualwidth=''
: o' y$ C' d, u2 p+ }$ Dvar cross_marquee, ns_marquee
6 X( D2 ~2 _7 E/ n5 n( i  H) t
0 B: V: J, T& p9 u( Z: Ffunction populate(){
# P1 S! s: z" J. a+ v( I9 Q0 }if (iedom){( C! _  o1 v9 V" j; B0 \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 u0 t  v+ n& T" S( a* `
cross_marquee.style.left=marqueewidth+8" [1 l3 Z0 f' T) k9 B2 e, `
cross_marquee.innerHTML=marqueecontent5 f/ Q. n; s6 G. f, U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ G! q. X" V/ y. S0 P
}* f' `- X; g9 W; S
else if (document.layers){
. b: h' P! h1 }! x( Rns_marquee=document.ns_marquee.document.ns_marquee2
+ N0 q" H, j) E' Y4 H  J6 Lns_marquee.left=marqueewidth+8
; S- c* G8 g8 f7 Sns_marquee.document.write(marqueecontent), r+ H- j2 P- C7 y+ S- E( M
ns_marquee.document.close()
9 ]3 J7 _7 C! @actualwidth=ns_marquee.document.width; o7 M' d! h, B- }3 {
}
3 J6 G$ w' u: Llefttime=setInterval("scrollmarquee()",20)
" A; b& x; ~5 b* s- g) u" T% g% V' s}
+ L6 M# N* C% p% r/ q! Fwindow.onload=populate  V) ]! H2 t: p  a8 H

; P, |' G7 X0 Jfunction scrollmarquee(){9 u0 X) s# Q% k5 P
if (iedom){- m5 O7 H' R( `. c8 O6 E8 x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) G$ o$ u  N1 S4 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: W: C0 l) y: V& S( t# Z
else  o0 j5 H, L2 C( R4 J0 Z
cross_marquee.style.left=marqueewidth+86 j# G3 r+ _; u) R  }2 V( c
1 b/ N$ I/ R; z- t$ Q
}
* E' [5 Y- C  R+ F* I7 U! d& p- @5 I0 t9 Eelse if (document.layers){
2 t% c" q+ u. W! \& I7 Uif (ns_marquee.left>(actualwidth*(-1)+8))
1 k8 E% Q1 w8 \1 Qns_marquee.left-=copyspeed
& y  q" I9 d6 j, R# B8 _else
- j* N* @: n8 b" C* S" ^8 Dns_marquee.left=marqueewidth+8
2 L0 B8 r; h3 T/ ^1 O. z; {4 S}, W  i! s1 O5 o  \4 w
}
) h6 N9 _8 C3 K! D# Z
( ]5 M, S% d2 T- ^% o- K- Tif (iedom||document.layers){+ g' z8 q5 x! b: V7 s7 P% h
with (document){7 J8 o7 [$ u0 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ^7 z) o8 W3 c! ^5 A" i# n1 Fif (iedom){
0 _; t+ _* i1 i5 i: s% q% lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ g# Q! U- o  u( L) Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 o2 B* b6 L" n0 t& M8 m  u. swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 g/ z! T# }, Y3 ]% m' I
write('</div>')
: ^- t. I0 Z5 y$ I- h8 X3 ~}
8 u0 M$ w/ u5 ~. j: Qelse if (document.layers){9 @. O* {2 F- j) P) _4 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 h7 Z  \1 r5 {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 ?0 i- J- Y/ T; c2 L# awrite('</ilayer>')% f$ N/ @9 `, N9 i/ C6 C4 a
}
2 P* A' y7 V$ v8 edocument.write('</td></table>'), Y$ ]6 v* b: `% G! R! E, c
}
& o# L# F' s( Z}
, p+ Z$ B3 e4 j4 U7 d4 |& I% ~( v</script>

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