返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. |, L/ s) Y0 u, jvar marqueewidth=300
! z+ \) O- d8 X//高度
6 p0 u- R( y, R' Z& F" hvar marqueeheight=25
( x5 n5 S+ }3 h8 ]//速度(1-10)5 y7 m, @6 K/ y! z. r
var marqueespeed=3
& @5 n, {. }& u) Y' g4 {//背景颜色/ W. P$ ~# [- y* ^' R
var marqueebgcolor="#FFFFFF"
& m( G9 J) w; T6 Q0 E//是否能暂停 (0=no. 1=yes)?$ |0 p' i  X8 k- Q" u- V: u! |
var pauseit=1
0 J2 q" u7 i. M9 K9 N
8 W7 ?! b' n' V7 A9 |0 l//修改显示内容% z) [. i$ s$ g+ a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  O4 t# P, N1 I5 y# a2 |
0 R; J5 T" c8 h) K6 z! p8 T1 \" p
  f7 }) O( ^* {2 b' b% f) c
////下面不需改变////////////9 E8 ]! F$ H' `. f8 P8 \
0 O/ L3 f! a& _' a
var copyspeed=marqueespeed, |1 R  L/ f9 `; {: ?* l4 W% }
var pausespeed=(pauseit==0)? copyspeed: 0
4 t8 a% p- \" A6 Q/ h3 [var iedom=document.all||document.getElementById
4 j8 z5 J) ^0 eif (iedom)$ p3 [; A- X- w7 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 e/ u( Z. U7 E& O3 x% B
var actualwidth=''
, A* J, z, U" X3 X' m# l$ ?9 pvar cross_marquee, ns_marquee
5 w: D; c5 k. E; [- m- [1 V. u4 i
# [$ T% z: ]# j8 ?function populate(){
# h" i" |3 L) m8 u" Qif (iedom){$ A1 e$ d# h, G8 X2 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 U! Y  \! i: R0 s$ p- U& [, f2 m* [cross_marquee.style.left=marqueewidth+8; ?2 Q4 R$ g8 u0 i
cross_marquee.innerHTML=marqueecontent
! i+ G: [6 c8 S+ O# qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 f+ x6 ?8 ~- T2 _}; K! @, S/ e0 o( S/ ^
else if (document.layers){& a/ {+ Q+ J% e& P! u+ _
ns_marquee=document.ns_marquee.document.ns_marquee23 r& u/ J+ K$ j* m8 ^1 M3 {  ^# Q  z
ns_marquee.left=marqueewidth+8$ g/ H( U& t' S* Q, [
ns_marquee.document.write(marqueecontent)
. E. j- h$ z* Y$ k6 lns_marquee.document.close()
; u4 i& s4 ^* T6 M1 N  ]% kactualwidth=ns_marquee.document.width4 e$ ?! \! w- n8 L
}
$ M) R4 q5 n# d$ L# l5 m$ f3 Plefttime=setInterval("scrollmarquee()",20)
) u; h2 i" T" t4 z4 ^; ^# z  c}! ?0 W9 O8 p% k! X  A' q4 }& d
window.onload=populate" N8 L- z1 g6 t! f, U" ~5 O- L. S

! @# \4 K1 Y0 h5 o: L  U) X0 Xfunction scrollmarquee(){
4 u# [( f+ q& G! hif (iedom){
, S( m2 y7 J* e# W, F  r$ k! D# kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ b/ L+ f% W8 }* C! ~! S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  B* W0 Q$ `6 m: T& ^6 W
else
, `: K) m/ ]/ ^$ O1 V8 y: P$ T/ M4 Vcross_marquee.style.left=marqueewidth+80 |- b) V" S. a9 [) @5 X3 K/ N. e
# |1 }# h& ~' k4 r9 e
}
- H; y) R. _' g: x5 W. ~/ Belse if (document.layers){
, m4 `7 g/ H$ H# A+ x) [7 Kif (ns_marquee.left>(actualwidth*(-1)+8))
8 }8 t! l) {! l+ z# x& b$ w7 ins_marquee.left-=copyspeed: O' ]" y# ^& j% }
else
0 u  f0 G: B1 {  rns_marquee.left=marqueewidth+8& ]  }. T/ _: Z
}
# P4 h) g: q4 n4 t}6 U+ p' f" v( Q
+ I# l: M* P% l  V. l
if (iedom||document.layers){& x; B& \* X9 m2 W( {" u: W
with (document){
# N$ t! R! o* g: W+ e+ |1 T) q. gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); E0 m# ?0 i. k9 ~* B3 I$ g1 }
if (iedom){
: `4 N) S* [, Y. O% ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 o2 A  P6 J1 z! L9 \: a7 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 _4 ?$ M3 s4 N$ {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% L0 a4 b2 Z, F" o: bwrite('</div>')
; B2 O% X- S0 X* Z! p/ [0 S}
/ S' S3 k! {: k- [9 {$ W) |1 I8 c' Helse if (document.layers){8 Y/ p0 ?/ }: |1 n/ Z$ g2 k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ ^  t8 d: H* l' U2 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), h/ A' p: m, k6 d( z& H- C/ d% T
write('</ilayer>')
2 c5 s2 B6 ~- n% z/ m9 F% v1 `2 Y3 q5 A}6 Z4 J* [- L1 w) H4 _/ Y( ~
document.write('</td></table>')/ S1 V. y! ^/ ]4 |
}% V1 J2 B3 ?) [  F
}
* t3 ~: t6 H" f. p  Z) C1 ]8 S</script>

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