返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 K$ D$ U, n& }: f
var marqueewidth=300
( u8 W: l6 {7 \2 ]9 T, i. b6 k/ V//高度7 ^% p. J# V1 v* D4 p2 v
var marqueeheight=25
* [  Z) l# ]8 p* o) N* C//速度(1-10)7 h8 D- ?4 }7 k% q3 O: ^( s
var marqueespeed=3
( M& x7 e0 a( d! c: T  W( b//背景颜色! f- [. {& y% O
var marqueebgcolor="#FFFFFF"* K3 O5 _3 f8 \! r- Y
//是否能暂停 (0=no. 1=yes)?9 l  v5 P8 p, N3 R4 d
var pauseit=12 a$ e, H- i- r) P' c3 L
- V0 Q& t/ f- E9 E. I
//修改显示内容
8 x2 [; R+ z8 @( \3 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 y5 `! w! Z& H

8 r7 |6 Y5 f  n: C0 a  H! g* w
/ p+ Z; m0 x2 z* o- |( j6 [7 ]1 e////下面不需改变////////////
6 A; {0 K7 N; W, D) n/ V
# S5 n* g2 D# }5 X/ `var copyspeed=marqueespeed" k! _2 T; r3 F  y2 n5 J
var pausespeed=(pauseit==0)? copyspeed: 0( T$ f1 I! e! g1 t
var iedom=document.all||document.getElementById
* _% {5 P- {6 G* [0 f0 lif (iedom)
4 X- v7 Q  W. F2 N1 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 }, b* G' s6 ^7 S* I4 h
var actualwidth=''
$ C4 ^, }* s- v+ a4 c9 c# lvar cross_marquee, ns_marquee* L2 l5 c9 |4 H  Z6 U- r, m* ^
0 Z: i/ y' ~& ~# [6 Z
function populate(){' h1 ]$ q$ D: [+ ]
if (iedom){
2 i5 L' x) V5 S5 G1 }0 Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. U" Y# |  g6 t
cross_marquee.style.left=marqueewidth+8/ j5 W: L0 T  i7 i
cross_marquee.innerHTML=marqueecontent/ D3 t! }$ A1 A. s/ W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 d. r  A0 w9 B- S; e}) H. O1 B' B9 H6 i
else if (document.layers){
  K$ q7 v) Q* o# l$ ]3 ons_marquee=document.ns_marquee.document.ns_marquee2
* a% W7 l# B1 X6 M) C9 Lns_marquee.left=marqueewidth+8+ u. C/ B+ t8 q& y
ns_marquee.document.write(marqueecontent)  \5 K: {, T2 h4 f0 g" p" i
ns_marquee.document.close()9 A+ k  ?0 M5 }' b1 }5 ?
actualwidth=ns_marquee.document.width
' W7 ^  u1 n6 ?8 S3 ~$ U}
. {* r1 }: ]9 |- vlefttime=setInterval("scrollmarquee()",20)
  g: E+ K3 o0 I# R5 e0 E5 t}
* P, \0 q+ D( \- _window.onload=populate
6 l9 F8 E  O& M7 `! D! d8 p8 A
! E- U) Z  u! \- C# B7 ]function scrollmarquee(){4 E* ]+ C0 L3 l! N2 U8 S3 {
if (iedom){, J( {0 n# @' G8 V# g' e* o4 T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 q- F' g% H  C, v) O: {2 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( v. f, f; M+ y$ Helse
( _5 J0 C* \' Gcross_marquee.style.left=marqueewidth+8
. x0 _4 L" h4 R' A) G
6 V3 S" V" \$ J+ N! C}+ s; b6 Z$ g4 L* a
else if (document.layers){
* Z0 ?3 \" I2 P+ Y3 _0 Rif (ns_marquee.left>(actualwidth*(-1)+8))% _- x- L, J' b6 P6 U
ns_marquee.left-=copyspeed
- E7 V8 i9 w: W' V7 M2 U* melse# l4 x% o2 `1 k3 v  f1 j( T
ns_marquee.left=marqueewidth+8
) ]( ?1 {0 J. q8 k+ I}7 v' Z# l7 N- O# m/ C. f+ R9 y
}
1 r7 j8 c1 `9 ^5 S3 V, t7 j% N/ @0 Y4 d* K
if (iedom||document.layers){) ~; q# S" Q" D. q! n  f/ _! A
with (document){4 v2 A" M# K8 V- k* u1 b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 c& C( e+ v% {! N" Y+ K5 K
if (iedom){
' e: O" @$ b0 J' W4 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( S" j- d! a0 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 U3 i( S4 x! `9 r5 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). n4 r" F" R% h7 e, O
write('</div>')8 j& _& X+ z$ [5 h& @& K+ v3 B: y
}
. t$ c% n6 P. Z2 f4 e3 O; N) x1 k# delse if (document.layers){2 |  @: S' d) j, G: [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 B, W2 H4 p/ z: d4 l$ I$ bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 A& S& e/ l3 x( @& r+ Z, r% q4 y% I% m
write('</ilayer>'). d( [$ G( }, d. |7 ?1 K$ f
}' d& J. Q. _% _$ i; Y, f% `! B, P
document.write('</td></table>')0 C8 d& |9 w# ^
}3 e1 A4 u/ M+ u! V- ~1 l# z3 P
}% F4 G; `; c* H4 [1 h- K
</script>

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