返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 s0 d* k. g# T! P7 L3 O1 G" [
var marqueewidth=300, ]" Y" U8 b7 [" ?. k8 N; c
//高度! H  v5 D+ A/ B) y6 L
var marqueeheight=25
* G: b- B( H9 F2 J2 @( S& s//速度(1-10)
: f  X( J) L( K) H2 p! y& [var marqueespeed=3
; ^6 g' V& q5 R6 \//背景颜色
/ U6 D2 Z2 q1 q# {; Xvar marqueebgcolor="#FFFFFF"
0 t7 a, B# s8 X2 P//是否能暂停 (0=no. 1=yes)?
4 {3 x# _) E8 o4 Kvar pauseit=1' f( ~  \$ A  ]7 M5 f
6 x8 u. ^$ y, m9 H$ D
//修改显示内容" N6 P5 L7 b5 i5 w) W% x3 p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 Z, p" `+ n% t3 }5 `

. v4 m7 H; W3 {
5 c2 _, N; |6 H4 c3 z: r/ Q////下面不需改变////////////
9 T+ A0 \5 w9 I' E/ G( E* N9 t$ B% ^" \
var copyspeed=marqueespeed
1 m( Y' v6 L; g- u( m" Evar pausespeed=(pauseit==0)? copyspeed: 0
  X2 L/ G. w. |0 v/ g. hvar iedom=document.all||document.getElementById" }/ N3 ?  l' E8 L3 a' A
if (iedom)
8 V6 b* i8 N" J; x& t$ Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 h1 y) Q* i! d9 K4 W+ ]- k  kvar actualwidth=''
* d0 Y  J$ y5 x/ avar cross_marquee, ns_marquee
3 I4 }, ]3 J8 }1 @. o! o7 C/ w3 H5 K3 `* P9 c! X2 U/ d
function populate(){
. L# R* C. H, ]8 A. Uif (iedom){
# @' j4 b' t9 E% i$ z6 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: n& @- C; V/ |' y% ocross_marquee.style.left=marqueewidth+8) i) a( }: h, w; Z5 m! x2 U0 o) p* Y% w
cross_marquee.innerHTML=marqueecontent
8 L$ l9 l" N( T' D# Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ O) Q$ i9 q. D& [- K
}. {/ ^* ^! R; Z  h/ J
else if (document.layers){
( S- Q' S; \! m) H( d8 q. Ins_marquee=document.ns_marquee.document.ns_marquee2
7 V: ?# X0 }/ z. z; _5 ans_marquee.left=marqueewidth+8
# v3 R. c6 G+ m$ _ns_marquee.document.write(marqueecontent)
. ?7 E( M7 h: c* `- fns_marquee.document.close()
$ [* e7 o; u  {. H' H" l: Y" Bactualwidth=ns_marquee.document.width1 c0 V$ {! O& Z% p0 O) m
}
" U2 q9 ?* A, l- @lefttime=setInterval("scrollmarquee()",20)) U2 `! o# j# x+ Y) ]) s6 _
}
3 M) a! q3 {. a; ]1 u+ cwindow.onload=populate
/ ?, q6 G! S$ `% }1 c
# S3 l  ^" p- k  yfunction scrollmarquee(){4 N1 x& V. X$ N7 l% x" f1 G# }
if (iedom){2 W) U5 _7 N$ K% I# h5 B# b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# N( Q) T. v! n% }' P7 C7 z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& ^' v) ]& |8 {' a' \+ ?else
$ J1 q. u3 t* vcross_marquee.style.left=marqueewidth+8
% S: V" `3 [4 V( ]( d% n/ B- j- E: c5 |; t
}/ E3 K6 I, j& G" @: U2 K
else if (document.layers){
9 \  S/ H; R8 v1 z' e/ ]: Z* jif (ns_marquee.left>(actualwidth*(-1)+8))
7 b# O7 t; z" W+ m. @: kns_marquee.left-=copyspeed
7 `6 _, P: z9 D9 b6 Jelse1 J  i4 N8 H/ l/ K
ns_marquee.left=marqueewidth+8+ B6 [% D: l/ O* G
}$ X: [& J+ W4 A. T! R4 w' c
}& }) W) u$ P# u8 B* R" E# q
) T$ b+ s$ y8 O1 |
if (iedom||document.layers){( l5 h: u, U: ^2 U
with (document){
  p- b% D2 p$ I- \% f) e# V6 }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 Z" X' i2 p2 H1 w1 kif (iedom){; X8 n5 G% ?6 A) K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ `2 B8 V* [3 \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ x! F1 @$ a7 z1 t8 p4 \3 Z9 H* P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 _" L" C; N; }/ O* ?; v0 T
write('</div>')3 Z, I2 K5 p7 D, _8 u' d! S
}+ ]1 `4 V8 f% ?( n$ i& |1 U( p: G
else if (document.layers){
$ e) D" w5 n7 y) m5 kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 X% t% G- e: J( a& k) Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. F2 m2 s% r0 g6 g3 \7 D5 [write('</ilayer>')
4 g& C9 W% [% E1 m( G}
7 W7 b. V4 K- H7 J5 t% z" M9 E" sdocument.write('</td></table>')
# }; I' M8 e  D. r/ v- R% k/ G) w}
2 C& _4 E7 o. j( s' M7 K7 [( `}
* F$ y, O: m3 E" ]# y/ C+ F</script>

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