捌玖网络工作室's Archiver

zw2004 发表于 2008-1-21 20:53

网页之跑马灯文字特效

//修改宽度&n@ h"j'_q2U5E
var marqueewidth=300%^A9o4D*i%A\C K9r
//高度
"H;\ jW8p?s2j2bp var marqueeheight=25
K'p/d el$R,g //速度(1-10)
3yP MF q K.` var marqueespeed=3 t0w`4La/PF,D
//背景颜色
X9?q9u qP4GyE var marqueebgcolor="#FFFFFF"
kt4d2?&fT7m //是否能暂停 (0=no. 1=yes)?DFUD} M$u SWS ~
var pauseit=1!C*{#o ^M'~#d

%W%v[f-h%J //修改显示内容
G"eGQn#e5sb var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
s~AaS{0uM
2gCTT8t-T t
j TK{*g*x ////下面不需改变////////////rY&Z(W)} lU&YB
R7i:F(\g
var copyspeed=marqueespeedk.gE_DI+x
var pausespeed=(pauseit==0)? copyspeed: 0
%Gse{D!M| var iedom=document.all||document.getElementById
7\+n d;D4`+P:B1`X if (iedom)
h!A*a Xm O$J'@ document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>');|#N u3Pd"Ee6lv
var actualwidth=''
2X0~"p#rxN7sw var cross_marquee, ns_marquee`2DH sUm%[bb6V1f
!y1P/t!X2dj1X!| I
function populate(){
H8@;K-hj-M0}q if (iedom){3w#yu O jc
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee[y/Y2Ey x
cross_marquee.style.left=marqueewidth+8
Y!gXfe1A r-V'O-@)^l8T7x cross_marquee.innerHTML=marqueecontent
s%^ ZG$p/BexJF:k actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidthN| S-yO^-R~z'~
}
K m9hb U$FK o9g0T else if (document.layers){(p1Wk.z} @n'[~
ns_marquee=document.ns_marquee.document.ns_marquee2
@v-@2`9FI ns_marquee.left=marqueewidth+8
Q5A D:t"zs2S-Hv ns_marquee.document.write(marqueecontent)6?w:y:Iz dm%j
ns_marquee.document.close())~T,`3q%M gVW.K
actualwidth=ns_marquee.document.width
nj*?k\ },vc*[?!WJg&g(c
lefttime=setInterval("scrollmarquee()",20)
"p'Z,Ka:u*~ b/{"P }8}0QH.~b
window.onload=populate
5@P T#G8y5F9L6R'O ga-p'yZ;dsO
function scrollmarquee(){
X9lv%N } Z"^3g3] if (iedom){
pkg1JIt7|7a if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
T o3NDr9zP3A cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
f.ij ])ldzG else
%~?zW9@G2W cross_marquee.style.left=marqueewidth+8K0{:m)W8SU2A

X pJd`-@v }5P#rf\X#Z n
else if (document.layers){
4C(l {9^A^'{| if (ns_marquee.left>(actualwidth*(-1)+8))C_8H%q9Ta G
ns_marquee.left-=copyspeed3V&H$Bu#w7V
else
Y[#zT;aV E ns_marquee.left=marqueewidth+8
]d8Y&z!y0fn }+Z3aF2q f`iA,e8J
}0g]DJ5D5M5}\7YdA
;e1X5]|S3`C
if (iedom||document.layers){-h$G1GaOlu
with (document){
_-n w5p~)Z9N` document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6uj+c]5{?
if (iedom){ K5~H!w ~~}%x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')lCD0|._.|9ed
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4G7|!}k{4|1L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
)gL%`[ RF write('</div>')"a+U#nYhW
}
8}oHUz:w.e%g C else if (document.layers){
l}$`Io0_)N4C write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
zRsJ"M Cu write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')eU/D#pR
write('</ilayer>')lsu*w9}]u
}H0V7_:|)E6U&t
document.write('</td></table>')[:`;oP UE]F
}#w HL+Ek7Mw9p
} ] ya{'V{^b;f7]
</script>

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.