返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 p- f% Z. K0 E4 K7 i2 n2 M$ J. n: [var marqueewidth=300
9 X, H$ y, Z2 \//高度
7 ?/ e$ `; \' h* a9 e, F( K( _8 V  kvar marqueeheight=25! d: I5 z. u  l, q) M6 v0 ~: J
//速度(1-10)
, d. |( R& P4 |# ~% n' wvar marqueespeed=3
5 s5 j; c4 k. L1 V% }/ q) C" p//背景颜色, N, U9 p. u' _5 W4 k% W
var marqueebgcolor="#FFFFFF"% i, i) |! r% N6 C
//是否能暂停 (0=no. 1=yes)?
1 O/ T3 N2 u, o  qvar pauseit=1) N. c# o* x1 R9 D8 J$ d& ?

9 S" j1 w' _& d) b3 ?2 q0 t//修改显示内容
0 o+ i* L( w( {# H9 A5 F5 t* qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* y5 L8 N% {5 Y3 ^2 j5 Q# y  |8 p
$ j/ Y* T9 l& v% w

3 w1 B# d, O0 Z+ O* c- K2 C- V////下面不需改变////////////
% s' l( e" Z2 p+ n9 L4 H+ R- e( ~1 I2 {5 C0 u$ s
var copyspeed=marqueespeed
! D6 R3 |& q3 e9 o" I2 Tvar pausespeed=(pauseit==0)? copyspeed: 0
5 i! U1 }) G$ e! Vvar iedom=document.all||document.getElementById
+ A  V+ `; B: Q- Mif (iedom)
; D5 H2 s+ ]; b5 o: Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' H) \* V: G9 n1 @9 R& c
var actualwidth=''- e- B7 ]5 P7 e0 N' ^& b: I
var cross_marquee, ns_marquee1 }5 U5 f0 h. j1 B3 P4 P. G
) d! ]! l. a7 X  A
function populate(){
; d" \! I8 ^, \1 z( Q' W! kif (iedom){4 ]8 x0 k" G5 _, \5 I( K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 z  h; y* J$ |$ p" Z0 y+ {, T
cross_marquee.style.left=marqueewidth+8; M+ m8 a$ o4 p8 n
cross_marquee.innerHTML=marqueecontent
  V9 _8 H9 [$ P$ Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" E, z* Q) p6 e: L}! P3 f6 b5 B+ l5 N1 l
else if (document.layers){6 p/ f+ y. K  |
ns_marquee=document.ns_marquee.document.ns_marquee2
, }* [4 K0 Y* u' i5 fns_marquee.left=marqueewidth+8
% v5 M  e1 v8 R* U. I' mns_marquee.document.write(marqueecontent)
2 v3 ^6 o; H3 B" T3 s! N/ E, _ns_marquee.document.close()
6 X- ~) x9 T7 o* L% Tactualwidth=ns_marquee.document.width
7 K) X6 M& e* @' @% |7 ^2 W}
6 s3 X' f; E! n  f6 plefttime=setInterval("scrollmarquee()",20)
! n5 k% V2 Z3 H) ?' m) ^}4 X, K: w/ q; u, S" v1 ]6 z
window.onload=populate
0 }6 {  e+ l' a: V; B- H: R. P$ O/ `! a
function scrollmarquee(){3 Y" U2 X! q/ n' _5 D
if (iedom){
7 e+ L) S# g0 x2 X9 r  A: dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* E% Z4 L6 X, F) K- y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 G5 b0 I/ r9 G, n* telse2 P. I0 H9 h; s) `0 o6 C8 n
cross_marquee.style.left=marqueewidth+8
& t4 f" z, v6 a0 ^
1 @4 }3 a/ J' o+ }. F5 h7 b}2 Y3 g) J# M% |# V7 {6 y$ P/ Y
else if (document.layers){4 F& P) `1 p- d+ {9 c+ U5 D6 I
if (ns_marquee.left>(actualwidth*(-1)+8))/ N7 Z$ p/ T% E4 O2 M0 b1 X4 A' F1 }
ns_marquee.left-=copyspeed5 j1 M& m$ v$ w! ^& M
else
! a4 D0 m$ |9 `7 W/ ?' ons_marquee.left=marqueewidth+82 A6 z' e: H- s
}
% f( M9 S) [9 {}
  }+ l0 [% _) g+ ]
+ z! F) g' E! V1 lif (iedom||document.layers){
  X: l) G) n6 z8 H& ~9 xwith (document){, w% H  s& V9 I, `9 z0 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). K2 P" p+ y: A2 v8 ^
if (iedom){
& `- v( R' _9 x% T8 hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 Q: Q! Y; c! m2 P0 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' N+ o& D' `1 E$ J! Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); K( h0 m# z0 p/ t; c# s0 L
write('</div>')9 R; D2 t! z0 Q$ O! J
}
* d. M7 K# H0 U# V8 y# Zelse if (document.layers){! q' O' }9 K) G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; _. r7 x7 O$ ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 E$ ~0 C$ b  m
write('</ilayer>')
6 Y& S( |+ v; i. S' [}' u8 J) N& p6 ~6 n
document.write('</td></table>')0 X" @$ A7 N. P9 G8 F
}1 k6 d0 s" q; o6 z0 b
}
) v  R* e( U+ V</script>

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