返回列表 发帖

网页之跑马灯文字特效

//修改宽度: U& X: {  h; w& N* u
var marqueewidth=300& v' I/ O( r/ T: K9 G0 j
//高度! h, t# b3 N$ w; t
var marqueeheight=25+ N9 [+ Y3 l( [; s8 B3 j
//速度(1-10)8 k2 J, P  l9 K- L! T( I& |
var marqueespeed=30 @* t" L6 r/ |8 i! f
//背景颜色3 |0 r7 G$ X$ r3 p% p& a& ]
var marqueebgcolor="#FFFFFF"6 Z9 A! X& a! }' j+ [/ c. }% B
//是否能暂停 (0=no. 1=yes)?
" D) e7 S0 k2 x/ n$ \* yvar pauseit=1
! i5 R+ C- t1 ?& z% P2 @( ^) d1 `5 V) x, A1 n
//修改显示内容
/ K1 o2 O8 V/ ^" T+ e' S" Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( `8 ~2 u: `, U
9 |) ^& c' o0 t4 Q3 h: T  x+ w' l
# _; {: P& X! ?3 j" F6 ^3 ^' y7 M
////下面不需改变////////////
9 q3 e8 l8 i2 g( }
/ |  c3 r4 X  j3 l6 O1 u' f# ~9 kvar copyspeed=marqueespeed& n( M8 h6 G1 G! X( N0 G
var pausespeed=(pauseit==0)? copyspeed: 0) ?$ M, O. y6 V( T
var iedom=document.all||document.getElementById
$ j- j7 G1 p' nif (iedom): q6 S3 K: h) y8 F5 p$ }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ^5 ^+ G. I. [3 E
var actualwidth=''
+ W' H) O0 t2 L4 c7 t/ _# ]var cross_marquee, ns_marquee/ c4 K- c7 ~: e8 I3 B
$ s/ A7 Q' B% G% K9 h$ J0 y
function populate(){+ D7 R) A1 i/ m; c1 B
if (iedom){. p) _( I! t1 C" c9 }" _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- e! i) d" W' W2 A4 L0 n9 Bcross_marquee.style.left=marqueewidth+8
0 K. g. r* M1 D4 y# O" fcross_marquee.innerHTML=marqueecontent
# z5 l1 N; M. `3 {5 U- }( O5 L, Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: o- X; f+ }- ]3 I+ i3 ]  N}' p1 Q+ y  y$ V  \3 Q5 p
else if (document.layers){
3 h, U4 s% L  \- v4 c4 U8 {$ ons_marquee=document.ns_marquee.document.ns_marquee2
- \% f8 V5 Y% {: Q% D$ d$ ons_marquee.left=marqueewidth+8' I( c8 c. N3 U! m
ns_marquee.document.write(marqueecontent)' @. r1 d: \% U0 \8 x
ns_marquee.document.close()0 H6 {! C# o$ t5 i% N3 L* E
actualwidth=ns_marquee.document.width
3 a* W: ^" v+ u% B( f}7 r8 \$ V  E0 J( d
lefttime=setInterval("scrollmarquee()",20): `3 N$ D- b# l- k$ C6 y
}/ r, t" S) J5 b2 g1 f6 a0 K/ \
window.onload=populate0 E! I# Z3 M1 ]8 t$ R) H' \7 v

8 V5 u5 ~: w5 C, \, y% hfunction scrollmarquee(){, n" i9 l8 x0 |
if (iedom){' h5 ~, L8 x) Y1 K2 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 m' |9 a" ^& Q0 ~, ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# y2 d9 c/ l2 Yelse
3 m$ U+ r* U& `3 a8 Ccross_marquee.style.left=marqueewidth+8
& x- X  H$ a# g: c. s6 p2 v; T3 Q: @+ B) W) O
}
. I3 q% }( E* H9 Q  ]+ `$ _else if (document.layers){
) I- F1 B# ], F1 X4 I0 C& ]+ A' Bif (ns_marquee.left>(actualwidth*(-1)+8))
" F2 i2 P, f0 p" s" `+ G) sns_marquee.left-=copyspeed4 b; F. E( b  g
else
* S- ?. ]5 c$ m; g, J. Yns_marquee.left=marqueewidth+8/ X+ A* |" F$ `  Z
}
' D$ `+ e) B7 Y& W% t8 M}) A. A# m9 E% J' q. M

' r1 e( `' ]: ]9 q' n; ?+ Jif (iedom||document.layers){
- v! f# b. m$ m& \- qwith (document){
, K1 A* a+ F3 b- Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" j- X7 z) C6 Z3 e6 s, p; f
if (iedom){
; S) o* H' C; u" lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 a" z" A8 O; i5 E* D3 q( [+ dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 n5 r: N- @$ ?) |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 w1 y. m& p: _) u( }write('</div>')* z% V. W# e, v5 y
}
8 V4 h7 r4 B- j7 h& belse if (document.layers){
+ X$ [: I, n+ owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! H9 z9 K% K- y! p# ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( y3 @5 z* Q6 a, h* w( w7 ^! b
write('</ilayer>')2 J) f% b( l: t4 s9 Z0 U
}
$ K' _( }5 L" {0 [+ j# r$ odocument.write('</td></table>')
; F/ ]9 E/ G% r8 G" G}
4 S. k3 j7 i, K/ ~  b+ U}
" E# c; x9 b( l% F5 m</script>

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