获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度( a' Z+ y* L* H, q9 O- x
var marqueewidth=300# w. q- m3 ]. }. q9 y5 G
//高度
9 d6 q# ]4 j" N+ Ivar marqueeheight=25) f- L6 J$ [$ h
//速度(1-10)
- d  \) f& }0 z. X1 F7 Nvar marqueespeed=3
7 m- V' e$ B5 z) Y! j* E//背景颜色
7 h! V" [+ d; fvar marqueebgcolor="#FFFFFF", L' ^& d0 y/ m
//是否能暂停 (0=no. 1=yes)?
( k4 x) M- o$ v0 jvar pauseit=1
# s0 {; {3 S, N2 e
/ i' g+ O  k: q+ J4 S/ T//修改显示内容
1 t. v8 P2 k- ^, m/ F) C1 Jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ j/ f9 S6 ]8 E( S9 s

: a/ I% L* m( S# f
  O% C# j! d. T0 {! G$ H////下面不需改变////////////& V- e# d; \6 b$ v) o) J4 w3 Y

( b, h9 W' D$ x1 W: bvar copyspeed=marqueespeed
3 @* t' w: f: h/ Jvar pausespeed=(pauseit==0)? copyspeed: 0
8 X3 B  Z- m% Q; E  w7 Lvar iedom=document.all||document.getElementById) ~" i6 Z- ?$ o# t
if (iedom)& P6 z! M. _6 Z  u; n# x) P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& z9 a$ l  m$ r: Q5 n( i! X
var actualwidth=''0 Z+ Z! d, \4 |
var cross_marquee, ns_marquee2 }: U5 B' u3 G* s
* e1 L3 m% J) i9 i7 T
function populate(){1 {7 M5 x* W) V9 `: Y
if (iedom){* P" }1 h' G  H! k& U! q: A. F: F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  T9 b* Y- y7 A8 b, `( d3 }
cross_marquee.style.left=marqueewidth+8
1 U0 A7 C9 i# q. A; J) ucross_marquee.innerHTML=marqueecontent
2 e9 u8 p0 i& \9 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. N4 R( m5 c! T# ^7 p8 r
}
( w5 G- n+ x  v' jelse if (document.layers){
4 z& a5 Z9 r5 [' z, Xns_marquee=document.ns_marquee.document.ns_marquee2, d) q, n7 H) ~: r$ i8 _
ns_marquee.left=marqueewidth+8+ e1 {3 \, q. z
ns_marquee.document.write(marqueecontent)- ?; L/ x" o! s# A' ?
ns_marquee.document.close()2 t+ u. R, r! u2 \' M1 |8 q
actualwidth=ns_marquee.document.width3 Y6 }' R7 @4 [
}9 N9 _1 b: `; }- H
lefttime=setInterval("scrollmarquee()",20)- A* I0 [0 A/ Z1 z$ L! A3 Q
}
8 C% V/ ~# R) B* B# Q& iwindow.onload=populate5 |6 K. ]+ H- z$ @0 Z
# ]7 w+ R( U( t
function scrollmarquee(){5 B8 @8 q9 f/ Z. x! s
if (iedom){
& ~" j" [2 y! z4 Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# y5 b( l4 S5 a3 @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 M4 P2 c5 h2 a
else
3 I; X! A9 b" k; |* Q1 w9 W2 Qcross_marquee.style.left=marqueewidth+8# ?6 X- ^! Z  b

" {' M6 r5 y* Q% v8 G8 Z- d% Q}
8 a6 U* {3 g! Eelse if (document.layers){4 A" K0 {( T* q7 M. ~. N8 n
if (ns_marquee.left>(actualwidth*(-1)+8))- z% c! `& R' U# z3 Y
ns_marquee.left-=copyspeed
8 E$ P. Z# ~4 z$ Q4 Melse# D/ X/ N- N; R
ns_marquee.left=marqueewidth+8  ?3 M# y" G, ?) V
}
8 [/ @; q( J) |* `}- L4 l+ o' I* Y- H

/ F1 n6 W4 z5 }9 wif (iedom||document.layers){
% |5 B! }& `1 q7 `with (document){
. c/ i7 z7 L! Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 f' \4 G$ ?1 yif (iedom){
* W) q& F# c8 [9 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& K9 C$ h$ h7 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ m2 ^- S, W" e7 P) {+ {" y* k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 L* I! i7 ]. T+ \write('</div>')
1 M+ `- n$ w8 _" c1 _* p}
  L0 f  F8 D8 melse if (document.layers){
3 O# {+ Z/ R% }  R* I! kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ o& B, e, k8 i2 o) T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 V8 P. U& t: G" y0 ]4 K+ K
write('</ilayer>')' r# _( {- m3 p1 A# {
}7 r8 J+ J6 v7 l3 v! J
document.write('</td></table>'), F+ e! ?# K4 s: x" |- X
}9 q& b1 d/ R0 g( N3 z6 t6 }
}4 J/ U  e; I- H% C/ P0 U  m
</script>

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