返回列表 发帖

网页之跑马灯文字特效

//修改宽度& S% F  m! p- i9 H4 [8 m0 I0 f! @& m. H
var marqueewidth=300" O$ I; {5 w2 n! c; B& C
//高度
& n& d5 I* v4 l" E  T+ {4 G* Pvar marqueeheight=25. {8 t- ]& u; W: T! V
//速度(1-10)
7 l7 g1 }8 ~+ ?8 w( L3 h' Qvar marqueespeed=3
! n7 C9 C; K7 G* j& [3 u# l//背景颜色5 `& ~" b0 b2 Z) j% m
var marqueebgcolor="#FFFFFF"
' L2 d  Q/ R) G# d' ]5 }//是否能暂停 (0=no. 1=yes)?
: k% j% w. c9 i6 N3 j2 G' t: f& Xvar pauseit=1+ m" l" F; z+ e! h

& g+ T" f" \0 `) T7 V//修改显示内容7 X: d0 Q; ?3 X+ t7 s, n, P6 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. A. _% d) ~& i3 k. C' W
" M! S+ e! b: t5 y
  I8 i( M1 b7 g////下面不需改变////////////
" `* `7 C" S2 r" @8 c) H! B+ R: P; t) r8 t. N2 ~
var copyspeed=marqueespeed
" Z/ }  ], p- X% l+ Uvar pausespeed=(pauseit==0)? copyspeed: 0
, ^* Z# K* z& M8 U2 |0 }# H* k1 gvar iedom=document.all||document.getElementById2 b( k" f1 `! g' L4 w, ]2 a' \
if (iedom)3 F4 V7 T: K$ u1 n3 ~0 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 r9 Z2 \6 s9 Bvar actualwidth=''0 @9 `& m) \6 l7 q+ F7 C( r
var cross_marquee, ns_marquee  b* d7 u: g  p( u* U2 i& J

2 F8 n2 t+ N2 v! S2 Qfunction populate(){
, L9 v# H8 |3 x3 E; s) t6 Zif (iedom){
9 f1 s: l8 F0 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- C9 @/ ]( F$ ?# G) i1 ~cross_marquee.style.left=marqueewidth+8
4 e" W, y9 q( b# }cross_marquee.innerHTML=marqueecontent
$ N3 g: V% K& x$ ]: t; _5 s2 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ Q2 i* y# M! f* x4 v
}2 ^2 m+ ]/ r* R+ O& T
else if (document.layers){
+ [* {+ p6 n! m7 bns_marquee=document.ns_marquee.document.ns_marquee2
. z* x1 H( X6 O2 t% Rns_marquee.left=marqueewidth+8
. K( e0 D3 x; T" {9 J) ?9 C, ]) ?' Ins_marquee.document.write(marqueecontent)
7 b) [: \$ h) n1 G& v( B! {6 Y  q5 ~ns_marquee.document.close()" {" D9 m4 a- {
actualwidth=ns_marquee.document.width; A4 t) M6 ?# y9 D) v- {' f9 p
}) B' Q$ U/ [2 Y1 H
lefttime=setInterval("scrollmarquee()",20)
* ^8 P/ l" f% E3 {}  b7 E0 _0 e' S; K
window.onload=populate( M1 V1 [! V& L( ~! t

2 [7 ^% i6 d8 }" Nfunction scrollmarquee(){" ~; U+ ]+ R' O5 w
if (iedom){
4 Q* Y' n$ f' v6 |3 |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% `8 q, @% i' k' g9 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 b1 w. }8 Q$ |0 @/ W8 m0 ~
else) ~0 @  |1 q; z. k$ {* c1 |
cross_marquee.style.left=marqueewidth+87 O+ O+ a( e, b% s

7 v$ P% n  s9 U/ m/ C: ~}% N. e* N" q/ H9 H, @  T! C
else if (document.layers){, K1 ]7 j- k) `7 s! G' O
if (ns_marquee.left>(actualwidth*(-1)+8))- i  y2 j6 @' k; ~5 ^
ns_marquee.left-=copyspeed0 ^: a6 O% q) B2 Y, u
else
% e  i- T! R1 X7 ]+ N. Vns_marquee.left=marqueewidth+80 W/ W& q5 x! k& f( X
}
  L$ f% n4 z8 d5 W& v}
0 x5 ?1 u( O- }7 y' S$ \
: t  l. q8 ~( K8 a2 ]+ E5 d1 K) Vif (iedom||document.layers){
2 a; {- D3 `4 y7 p. L5 ^; o2 N& f8 pwith (document){0 i2 [& M# k( G6 h% T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- y& y: S1 Z* U
if (iedom){
& @* B" F. S2 L  ^4 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; z9 ^; }# r8 {. N* lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 r9 p; H! u& B, }% C  h, |# p+ P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ p* `2 L  e7 T/ x( k/ n4 b
write('</div>')4 l% e. c- }! }8 g
}
: [. ~- s( j6 O) I7 ^; ~8 ^else if (document.layers){
9 B; |4 L- q, k+ N% Y' ?5 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" {! L' e+ \* z. D" m4 p& \9 n2 O5 ~# Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  u$ Q5 ~5 g" `+ W: A1 kwrite('</ilayer>')+ X. x- k) u! I6 |; s, Q: {- v* p
}
1 g# [' K1 t+ c! k. Z% R- rdocument.write('</td></table>'), V6 b1 y& l0 q  T0 Y) G* d, K9 e
}! P* J: i! j$ c, `0 c' O. r8 ~0 N
}
" [* G2 A$ m& Q</script>

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