返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. v9 I3 M" X! P" c$ uvar marqueewidth=300
% W* {/ X# @) S2 k! e) }//高度; H, w# b' x0 O/ E
var marqueeheight=25
* Z4 o+ M; y$ \  Z9 V( l//速度(1-10)1 ?2 J& Z+ V) G$ w# X
var marqueespeed=3: X$ _3 T2 f. ?3 X' D9 F3 O
//背景颜色
) Q1 y2 h( u3 ^0 {$ M2 \+ ~var marqueebgcolor="#FFFFFF"4 w) p' y" z6 E, V' r
//是否能暂停 (0=no. 1=yes)?
7 L& J" t6 p$ s, n) ovar pauseit=1
3 G. N1 \( T- Q- j* k; \6 [# {8 w0 p( r5 l+ h( @1 M; o7 u2 N
//修改显示内容# H* b5 o3 D5 a  X0 ~0 H7 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 Q/ U, ]( q5 I, C" u/ [+ K9 n. B6 f- S, ~' U7 g

- ?3 O6 u& g: h4 t% i$ O6 f////下面不需改变////////////
& ~6 Q9 F, |3 E/ l1 E" Q
1 A9 y3 R( j: `var copyspeed=marqueespeed; |+ U& j# T& U5 U1 S% ^0 h5 z
var pausespeed=(pauseit==0)? copyspeed: 0
' n+ x; v1 D6 Y' i. q7 l: Jvar iedom=document.all||document.getElementById3 [; ]+ G$ D* {* r: e
if (iedom)4 i3 L3 {; w# P3 p4 J9 z2 U& t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 H1 `9 V& n% u/ K2 W; F
var actualwidth=''2 I5 A$ L3 Q0 v) g2 v9 z3 y
var cross_marquee, ns_marquee
! N/ W/ G$ |  `  e
( P7 [! D( _6 lfunction populate(){
4 Q$ [" @8 v$ }/ @2 j4 v  Z6 aif (iedom){
; ^/ i3 Q+ q3 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* c5 B& c/ ~7 P, e2 ^
cross_marquee.style.left=marqueewidth+8
' o9 t9 _; s, @cross_marquee.innerHTML=marqueecontent
* c) P% t- h, |/ B1 n  x& @  Z7 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. L# a9 l$ w6 V3 ?* ]8 V0 f: [}, X! G) u8 D* D: v) E( {2 K
else if (document.layers){& q$ e0 C; k* O  U, D
ns_marquee=document.ns_marquee.document.ns_marquee2
2 J1 t6 {) W3 Y5 \: Z# A. `0 \# \ns_marquee.left=marqueewidth+8, D( z  Y' ]3 O4 E, t6 A+ d
ns_marquee.document.write(marqueecontent)0 z/ L& p( r* H4 z3 D5 u
ns_marquee.document.close()
. }- w* I9 o, o, Hactualwidth=ns_marquee.document.width) I* @, d. s4 Y5 P, m
}3 m9 L, A+ ?3 ]. c1 o
lefttime=setInterval("scrollmarquee()",20)
; c8 o7 L) t5 x* L  R- v}
5 F0 J# L) t5 Q& ^; Qwindow.onload=populate, ?4 O4 ^4 w( Z2 F0 X+ X, z

$ a- S+ c! p, m7 U. Z- {& U' vfunction scrollmarquee(){" I6 O* u, g5 {9 t
if (iedom){
4 V2 s; \! Z: M" \. b# |( {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 X: A! e% u7 b& f$ I0 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ k# K& E8 H6 {; w$ v* [else
& U" G8 v. u9 Q. N; Rcross_marquee.style.left=marqueewidth+8
, ~& P. V' h+ ^2 E( x8 c- x7 f1 P# Y( c; J
}
4 T7 g, s1 o+ V) Y0 celse if (document.layers){& I7 `  j) v5 ^; ?% h# h) ]" h: w& z( F
if (ns_marquee.left>(actualwidth*(-1)+8))
& H! q4 g: ]6 Q6 {ns_marquee.left-=copyspeed
1 {9 x& c6 |- Q/ _else
* L+ H, J+ Y: x9 R9 _8 Bns_marquee.left=marqueewidth+87 D* `5 m. o, ~  M2 D1 N& q( N
}
0 ]7 u$ Q/ ?; f}
3 B% g# _0 K/ p; X, I# Y
6 `1 @, ~, \- j. Fif (iedom||document.layers){# \: e/ j$ i% T# }9 R- z6 ?; T
with (document){, R9 h- w8 A# b" ]% f. Y( \( V- e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 R* F- {5 L( W( ]" s; rif (iedom){
! Y3 M! V+ m5 l6 [2 W$ m; c, a4 `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ `7 B- s: _5 ?' N) \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 o) ^; s% c7 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  b( A/ L4 ~# |# _+ j, A3 F
write('</div>')
" m- b# k. o5 h2 @% W, r# {& j}
( `. j! s: i" y4 N- \* p0 f4 w( v# nelse if (document.layers){* b9 p" Z, U. g# }" q* n; }% C% C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( H% _" u: m. F2 w9 b  B' ~3 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 h8 C$ f4 T% G5 }4 R, C5 ^: `
write('</ilayer>')
$ C8 R. b3 x& a, u, F  \$ a}
' K6 _7 p8 y7 f" O" p6 tdocument.write('</td></table>'), @  n1 D# d  F- a
}
- S8 P2 U- B7 k5 ^; T" k5 V9 Z}4 q- Z5 T" K/ X+ S6 _  Q
</script>

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