返回列表 发帖

网页之跑马灯文字特效

//修改宽度& A/ ~+ i4 ?$ _" N" t
var marqueewidth=300
" p! n5 m6 P- W' Q* k7 J//高度2 W0 Z8 I5 C5 F/ Q2 L
var marqueeheight=258 g- I. ^7 e: n( L, L, `
//速度(1-10)$ \* o0 u; u6 R6 o$ v3 L
var marqueespeed=3
, [% _/ c& T) W# n//背景颜色) D5 U% l5 b+ f: l0 a6 N; K  L9 _
var marqueebgcolor="#FFFFFF") z4 a; y, _) k! x# w2 |
//是否能暂停 (0=no. 1=yes)?
, Z" I; d: |/ `5 l: c! tvar pauseit=1
( p- `" C6 B% f+ r: k: r+ a7 Q7 S9 S5 ]; i. N
//修改显示内容/ v. G% ]2 c* v# P, x9 f% x( N4 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 s# S( l* Z- i, j/ j. U7 L5 o* q3 l  q; I- z* `0 ^
9 Q, ^# R& `9 d* _: Q5 ~& U: g
////下面不需改变////////////5 y1 A3 `( x- A7 w5 U' [! G  U
% H6 L1 |2 b( x9 X
var copyspeed=marqueespeed/ p# i5 ^2 O: y7 r+ ^+ R
var pausespeed=(pauseit==0)? copyspeed: 0
4 ^: f& c8 |: L6 j$ H! `var iedom=document.all||document.getElementById
+ g2 k4 p/ x* f7 B: i( a, Cif (iedom)
: v" S! y5 y) Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): j# p% {  u  {; q+ y* e
var actualwidth=''6 r3 Q$ x) B) U; v' ?
var cross_marquee, ns_marquee
% t! f( _8 Y  F2 |
' |. G8 {5 ^; J4 ifunction populate(){2 m- H2 R# I1 n$ n8 e% g5 n2 l
if (iedom){$ m, ^  X4 d7 M- f8 O; a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 l7 t$ Q: H/ x2 y5 j
cross_marquee.style.left=marqueewidth+8
* V: ?1 {* n" v4 t2 icross_marquee.innerHTML=marqueecontent
3 i! k8 F0 x& D% L/ o6 b* Qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 O( L( Q0 X2 w
}
; P1 `- k4 p4 [# c- jelse if (document.layers){- i: q% t9 l! d6 B, p$ h0 u) P
ns_marquee=document.ns_marquee.document.ns_marquee2
: o  D7 z6 ]4 O$ S* t6 qns_marquee.left=marqueewidth+8
, n% y" `" d3 e/ w1 T  ans_marquee.document.write(marqueecontent)8 h2 P9 J, f% P5 l5 m
ns_marquee.document.close()
8 f8 ]" T7 }: ^. {actualwidth=ns_marquee.document.width) t5 C. ]# \9 S
}, p( h3 u5 j# M0 j
lefttime=setInterval("scrollmarquee()",20)7 w5 a, O, M/ b2 b, Y
}, ?% h) |" x! ?4 T
window.onload=populate
# s1 K+ W$ y- O" u  `/ t  W& i5 j; e% C% e# p9 c# j
function scrollmarquee(){
8 d" f# s) C, c1 r5 P+ s" iif (iedom){
, h% Y' t% |& t( Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 j9 F3 i7 n' Z$ m9 z+ s+ ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ x! ^1 \; q7 v$ c4 Yelse! o3 l5 ~$ e4 G
cross_marquee.style.left=marqueewidth+8
: n) m$ N. d4 A6 o- h, b, ]. V& T& r% n: k
}
" c- a4 _, e8 ^/ ^else if (document.layers){$ B! q9 |  ^5 t' x( S$ {! E, P
if (ns_marquee.left>(actualwidth*(-1)+8))$ p# }% B" q# Q3 _
ns_marquee.left-=copyspeed7 _+ @4 [) L9 q6 k9 O
else
2 C; @! D. y6 @# cns_marquee.left=marqueewidth+8
' d0 g# P6 l- F}
/ h; I# Q/ [  b- m6 L}1 }/ c6 W8 E$ t4 T6 O( k

# u0 W$ l/ [3 ~, {; D0 W( F: ]0 t& r1 Jif (iedom||document.layers){2 S2 E3 V7 H5 X! A5 m
with (document){
( Z' F4 W* w# x: f2 u8 Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 y' [: m7 @0 h- y! [
if (iedom){
& }  m* M3 ~7 O; cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  ?3 p$ k3 J7 L$ `, T7 }# ]# Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 i% @' w& p7 _0 W3 _: Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  W; p0 b* e5 ~write('</div>')$ M6 r. T! D  z' J) q: M7 ]5 b6 b
}
9 P$ ^% `, X, `' a* ?; _: qelse if (document.layers){
5 E9 |# o! ?' |# }/ z4 g1 h  cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ W! m5 w  Y/ ^9 a+ C# Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& T& S1 M' ]& W- B
write('</ilayer>')
% r: Y+ \1 X7 K6 k% ^" i}, ~- {5 M0 V, K* D* {+ t+ H
document.write('</td></table>')6 P5 @7 s% B% C; @9 H0 z
}
9 S& |  R' N1 Z& c0 l* {' L}; {+ E7 U/ Y5 ]  }6 R+ u7 E
</script>

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