返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ f6 s; @1 w3 V- d" x
var marqueewidth=300
# w9 t, E! |$ f  Q7 V//高度
& p1 L/ G2 u2 _8 j" ^$ P" `) u+ Cvar marqueeheight=25! p. w& I! L; x/ T1 w3 D1 t
//速度(1-10)
0 Z: l! e4 w& l# t4 Vvar marqueespeed=3; ^0 J5 Q' |7 C% f& P7 z
//背景颜色
- m$ }  g/ q. `7 J3 Svar marqueebgcolor="#FFFFFF"
# `4 f' F# X+ i' Y//是否能暂停 (0=no. 1=yes)?9 L) v. f1 r. ^
var pauseit=1( ~( U( c5 I+ R7 d1 B2 d3 d

5 V1 w. Z& i( G3 T: I//修改显示内容+ N8 @" I& M  `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ E3 g9 `! i9 @2 M! x) s& O- k& e) K

5 K, e5 e$ Q, V+ F% ?$ ?; g& R7 Q# l" y# `! {
////下面不需改变////////////
& J2 ?, G* C( e1 ^6 ~. H' x7 l6 V" \9 r7 S8 a+ p& r3 G
var copyspeed=marqueespeed
5 R1 E% Y" x5 ]0 L, @+ fvar pausespeed=(pauseit==0)? copyspeed: 0
5 _! H" V) ^  J. avar iedom=document.all||document.getElementById' o7 n" _: q7 v- D" [& n: _# ~$ }
if (iedom)
/ ^  X5 H8 L" Y" V4 B- `! K- |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 K) J6 V! \" r' p* Q% [
var actualwidth=''
9 o4 V) o. ]8 g6 ]( Ivar cross_marquee, ns_marquee
3 O8 @9 P9 J  w" e$ Z7 X( G$ ]  B" x3 ^2 d! e: Q
function populate(){
2 L- E7 G& p: Dif (iedom){
7 `% y+ o  A1 E/ @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; s; P% p: n" }1 t) g1 m6 o6 gcross_marquee.style.left=marqueewidth+83 ]& Y. |) J  o% m( M' X& B
cross_marquee.innerHTML=marqueecontent
* h: m* |+ ?9 z3 l; ~" nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 {& t& f6 q8 V! U7 z}3 M5 Z4 L- C/ T" s
else if (document.layers){2 m7 B6 V9 N. @0 e5 u; d
ns_marquee=document.ns_marquee.document.ns_marquee21 ?) I( v: X4 v+ i" P
ns_marquee.left=marqueewidth+80 c( A& O# }( `7 Q3 [
ns_marquee.document.write(marqueecontent)  {0 D+ a# n, v3 h
ns_marquee.document.close()- ~* o) o) u4 x' }
actualwidth=ns_marquee.document.width
. g4 y2 b. f" B% v. m) q# V}
) h  s, _' q- }' K7 l8 blefttime=setInterval("scrollmarquee()",20)
+ K$ }" H, K- M' o}- k2 z% u- ]/ f" K$ a+ b" K
window.onload=populate  {- Y  u/ P. A! n/ F0 d( a: U* m& c
1 Z) Y# L2 c" R  b9 K9 ?; O5 a6 E
function scrollmarquee(){
  a3 r; ?" x1 L0 Nif (iedom){9 n. |7 Y% t, f* T1 e5 b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% V; d! B/ |* A/ ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. O! e* g! K! `2 r, |
else
% I4 L- ~  X+ K3 ^- ucross_marquee.style.left=marqueewidth+8
9 {0 G; V$ K' u& A3 X* O$ c5 J9 w1 t: B9 t! Q6 ?
}
- _2 w9 W6 g6 ]3 `- u6 pelse if (document.layers){
# o8 G1 G! H4 R# e) b+ ]0 Hif (ns_marquee.left>(actualwidth*(-1)+8))
9 Z' m0 y0 [0 f" R7 Q4 Fns_marquee.left-=copyspeed5 B4 G1 m6 H- r1 d& y* G
else: l0 G8 v. b8 J' A$ t2 S
ns_marquee.left=marqueewidth+85 a: f1 C: g2 f! Y# t$ n' S& @$ B
}) V  T0 A) I2 E/ G) Y- s/ z# w
}: y1 N% W  ~* ]% F
: Z% N' W; F" f9 u
if (iedom||document.layers){1 C" r% X) L* O& @
with (document){! l) C# Q/ W  \/ d+ t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 i" v, _) w5 B" K# F) A; p: L% Dif (iedom){7 x5 j' \# [+ M8 o) \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 j4 ]/ X* a+ [4 s# ?3 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 M$ A- c( n/ b$ c0 Y5 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ x9 q" ~+ u7 g
write('</div>')
0 n3 H: h. [3 r( z. o. o5 C}
$ n! f4 a  A" helse if (document.layers){
3 E# Z: B! q+ q5 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 m) E! {) B) y. a/ ]3 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: w- ]: h( {$ j. K- p" T& mwrite('</ilayer>')# O% J+ j: ?. d- b# {; f* \) i* s
}
, t4 g  \8 t2 r  q$ W: Hdocument.write('</td></table>')0 q+ r# H/ d6 B# ?
}
% {& e+ o. r# D5 Y}
9 O* X) I9 w7 U1 B</script>

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