|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度- I: ?- |! M6 R- O% W. u3 `9 b( c/ h
var marqueewidth=300
2 _3 W1 r( p1 A//高度( _9 z5 h3 y$ @! `; Y
var marqueeheight=25
) V! C: T, _1 ]7 ^& d//速度(1-10)
& ] T6 v4 h; x/ `7 @$ n7 Xvar marqueespeed=3
- R) f& U& X/ E+ n7 U//背景颜色" D' E) ^0 M5 q/ ^8 [. Z
var marqueebgcolor="#FFFFFF"
. l/ v( J! v& ~4 V+ N3 E//是否能暂停 (0=no. 1=yes)?
* ? Q5 d: c) d7 W) j; S. s- Wvar pauseit=1/ H# U& \( u* C8 ~! ]" ~. a
5 ?8 a+ c ~5 p6 Y$ _& r//修改显示内容
) ]5 p8 G) y% e; m9 N5 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& N. B0 o* L; a) ]$ s
! K) g2 x- H1 Q' `- t% e
) r8 z, k) g6 N% d! F/ d5 o8 N3 t////下面不需改变////////////; p3 @1 l5 S: X5 p
- w/ P4 w/ s4 ]! [7 K
var copyspeed=marqueespeed
0 D( C- _& B% nvar pausespeed=(pauseit==0)? copyspeed: 0. {0 _ {- ^0 ?
var iedom=document.all||document.getElementById; F$ h2 s& y% l6 c v4 U6 h! o' b
if (iedom)) M" p, Y X* f5 f6 Z) ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): V9 \% V3 m( C8 N( \
var actualwidth=''% G3 c. {: m# U& h0 P
var cross_marquee, ns_marquee- c) k F$ D/ x. m
$ k. D3 T s6 g3 g" c L3 D4 ^' tfunction populate(){
& }4 k! ~; D p8 _0 A- vif (iedom){* K. Y4 A' H+ w" Y5 Q k; Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; X Y$ j% d' ~) D' @$ F: V% Z/ S" mcross_marquee.style.left=marqueewidth+8
" }1 `" z7 `- w8 U7 xcross_marquee.innerHTML=marqueecontent
9 g' Y3 Q! ?" W y @8 N' b% l8 A9 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 _9 ?$ I5 }) k7 ~}
% a0 ^' y: c& }* t v" ~else if (document.layers){ I1 N! I d8 ]- N& j+ Q% g
ns_marquee=document.ns_marquee.document.ns_marquee22 p3 f, w% z% x; o* L& p% c
ns_marquee.left=marqueewidth+8
+ c' g& L6 U( k5 Kns_marquee.document.write(marqueecontent), b' R. m j+ i
ns_marquee.document.close()
# r2 P. B$ f" o2 V9 |actualwidth=ns_marquee.document.width- T# q( }$ D; z3 |9 \1 p
}
! `6 S* }, n$ x7 ^* l; Elefttime=setInterval("scrollmarquee()",20)
( B) w9 M F8 d5 J; i9 y}( E2 K4 w( k! ?0 {% h: e* F+ n
window.onload=populate
' | v, ?2 b9 J( U5 B# E4 o* d. G
function scrollmarquee(){
7 `: S) w: {# Tif (iedom){
- {' T- H) Q m9 ^4 o: A g8 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" q9 p5 q A( U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% v' F: j2 I7 R6 Nelse4 n9 M' W: T: c& A6 ~
cross_marquee.style.left=marqueewidth+8
( Z& {9 E5 O2 `# j2 E5 Z
( O0 `& ^( A* g. C9 h5 r L}
1 u) _$ u+ }! @7 L+ u' melse if (document.layers){# s9 v4 U$ n9 K7 H
if (ns_marquee.left>(actualwidth*(-1)+8))
/ g9 g4 X6 n% n( y' W) M; O& Fns_marquee.left-=copyspeed' n$ D6 C+ W, }! D8 ]
else
( A9 O6 O' S3 f5 n: pns_marquee.left=marqueewidth+8$ q4 q$ _, N: R
}" F2 o1 b2 j4 Q/ N9 } s
}
; b* s; g- L4 @( G( {
; ?. q) B+ d; G' i; Y, C+ S3 mif (iedom||document.layers){! R$ z) G1 N% c; @
with (document){7 \( Y& ?, @5 p5 o4 ?* ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) w1 X$ ^3 w6 ]* I' z' W: ]
if (iedom){
5 `5 B3 Q! X3 f5 Z! z3 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 _; x3 S/ Q* |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 x$ i! M2 j) M: Y3 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" C8 n* B# [! c0 K
write('</div>')
/ l2 K3 q4 G! T2 j}
2 a0 X6 } T5 ^5 j2 @: [; T7 Selse if (document.layers){: Y( L! v F! Y2 Z+ \3 F2 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; U% N; n4 Y/ ^, O1 C+ vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ _* a, s6 e& J! [/ Z
write('</ilayer>')- K+ L* t9 {( q6 G9 t
}2 x% w- y: D3 ]+ e( q: C% h
document.write('</td></table>')
1 F( w; F8 b7 x8 a, K3 j9 a6 ]}! U4 s* k5 e& K! x/ ~ ^" n+ f. x
}
% f& i+ W3 P2 h* {) D# [</script> |
|