返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 J: M: `# a' c4 t' avar marqueewidth=300& g. D2 s3 q' Q' ~
//高度
0 q* a4 @% c4 S- Nvar marqueeheight=251 x  R" \% ?/ m, q
//速度(1-10)! @& e  ]1 R* _, B% H
var marqueespeed=3
5 J- P! F  m, ?, x6 O/ Q//背景颜色, d# l1 Y8 M# |2 e, e
var marqueebgcolor="#FFFFFF"" j) X  V( q$ H, Q& L0 u
//是否能暂停 (0=no. 1=yes)?
. \5 w) V' t- P, ^% X  l% }8 jvar pauseit=17 x" e* t# f# {8 m" U# I% v

+ a( D! q6 _- y4 i% i//修改显示内容' Y9 [- q) [0 I, S. p" G; X/ }, m, K, k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# A9 N2 R: E6 i, E& ?4 J! s; ^6 Y% |! x  K0 A% @
6 F& O4 b! m8 p6 T$ w. A# i
////下面不需改变////////////' D  ^0 Q8 L7 L9 t$ I' z
6 R; ?* U7 t. Q1 L1 l: K- u4 D
var copyspeed=marqueespeed: J: F* `& f3 c6 @% m1 U. ?
var pausespeed=(pauseit==0)? copyspeed: 08 T* ^3 |6 w9 [4 |
var iedom=document.all||document.getElementById
8 q# u& V2 z0 }if (iedom)
: l9 _: C0 P8 G: |0 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% _* s# l/ f, N" f1 C  \var actualwidth=''6 p6 K1 a7 T  F2 z" H/ b/ W$ T9 F  o9 n
var cross_marquee, ns_marquee6 f( w9 i" C" k$ ]
3 G0 x* @" i5 E& f9 F" B8 _1 ?7 ]
function populate(){
: m0 c7 ~# i/ s; G9 B0 jif (iedom){+ g# C, \' d' R, Q" ~9 {$ t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: Z# }. |: Y/ o# P& R) O$ a; r( B* Ocross_marquee.style.left=marqueewidth+87 G0 f% W" M! n$ A! s( Z
cross_marquee.innerHTML=marqueecontent8 C5 o; r1 Y% u+ o3 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  V% i3 H! A, c" ]}' \/ V4 \+ K5 r" `+ _% n' o4 f7 X
else if (document.layers){
% y& ], B/ W0 g2 u% L. ^6 U7 [ns_marquee=document.ns_marquee.document.ns_marquee2
" {- s: W6 G6 N  M$ ^! x  U3 \ns_marquee.left=marqueewidth+8
( L( \. i* Y$ v2 Sns_marquee.document.write(marqueecontent)* ^: f, \/ g! }2 ]! q. q' E
ns_marquee.document.close()$ @( o6 s  {% e3 t) `
actualwidth=ns_marquee.document.width+ ~9 Y5 ~& K3 E8 V
}5 g5 [# z( Z# Q
lefttime=setInterval("scrollmarquee()",20)  `4 G- [; C2 A1 a. r
}
8 I2 i! s' S3 J9 C& p- `/ zwindow.onload=populate5 T4 j0 z% E) P  c# x

; s) q' ^3 e: ]. Yfunction scrollmarquee(){
; Z7 h1 K" ]7 _3 N; `- G+ s5 bif (iedom){
$ e1 x- y1 T5 ]; K- ~+ E" Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 F  ]1 H6 [8 g7 ]# J" O8 p1 t0 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' s% ^9 h- \' G- X' Z2 jelse9 F$ x! E6 Y1 O
cross_marquee.style.left=marqueewidth+8
* ?1 u+ h9 \/ f: U; G% q' o* }
. {3 N" W4 s' L+ N) g( H}  k/ {4 U4 z, o$ \
else if (document.layers){. P; Z! K, W& R& K" e9 K
if (ns_marquee.left>(actualwidth*(-1)+8))2 F0 c8 `+ ~9 @0 F4 f
ns_marquee.left-=copyspeed! k. y1 f: s0 Y
else
% i- Z7 u* h" K* J5 v( p8 F0 Gns_marquee.left=marqueewidth+89 ]4 h% ~, Z4 D3 u! O9 K, ?# a
}, h, d6 J" u) Q+ E0 a
}" s( _1 {! e: v8 ^# L- n, s5 @# H

/ ]/ n' O& A* k" {! Uif (iedom||document.layers){1 ]. j. b$ t+ t+ a
with (document){* B7 O0 v) B; J7 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 n& `) |6 S& [6 F9 r6 ^1 Bif (iedom){" P6 X# [2 i' J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% A' M2 a) v5 ~. S8 Y4 U6 p0 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 s4 W% O5 g# Q2 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 Q. ^( b* \! v: w# }* D, Gwrite('</div>')+ \, d6 n# p: l! j9 {
}
+ T8 P" O4 [' b4 welse if (document.layers){
0 Q( |% C7 h6 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 i* Y0 l. S8 ]2 G( B4 L- A7 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* P" n" ]" }& ~" P( H. ~& ewrite('</ilayer>')
8 V) H+ |# K1 f+ e  P}+ W& j) y- U1 G
document.write('</td></table>')1 q5 h, j5 i- q1 K( Q9 H" A
}
$ F$ l$ x; T/ X9 s}
  l" I; W. K7 W6 s</script>

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