返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 U' v% E6 |0 s# ~* m+ ?# e8 [+ \! w. O4 G
var marqueewidth=300
" h' y: y6 L6 e//高度& ]0 i. a, o0 J( |& r7 F
var marqueeheight=25
( m/ T% U, a7 U6 _4 b2 V* n//速度(1-10)
2 e- g2 n2 t2 zvar marqueespeed=36 c2 i2 x  ^+ [8 Q& e; }) t
//背景颜色1 O, z2 I+ \2 v" n' B! X
var marqueebgcolor="#FFFFFF"1 s, ^; k8 M$ B/ ]: W4 [
//是否能暂停 (0=no. 1=yes)?' N5 n0 z: y9 B% M
var pauseit=1. s1 p# q& _6 B7 H5 Y3 _  M& g
( E: z9 b2 W/ p8 U8 ~1 P( z$ }
//修改显示内容
3 O/ W; r& G' q7 Z, Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': o( Q: S& R! s) d: s0 Q: \

% A+ Y( h) A: R1 C2 S, p; y9 W) M
////下面不需改变////////////! f% |# j; v% q0 C

2 Q2 w8 W" v7 n2 B  M6 {. n3 y" K6 Xvar copyspeed=marqueespeed7 Q) `1 ?+ A# M2 W! |) l$ x5 T$ q/ `
var pausespeed=(pauseit==0)? copyspeed: 0
7 ]. i7 r8 d% X4 bvar iedom=document.all||document.getElementById
, `$ ?4 G3 Q- \: ]. g- a8 Kif (iedom)
4 w2 t5 \5 f" x6 ^( x  ]) ]/ T* Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" E% m. P3 w: @# k1 B. ?var actualwidth=''. W$ D3 z( N$ I0 {& f! a) o+ B
var cross_marquee, ns_marquee3 n, x( E: @! R: W& M; Q
; ?5 E: Q6 G/ @( D3 \6 W# `
function populate(){3 J& R2 w1 ?' @2 t- r* X
if (iedom){
( E$ w: ?* l  I9 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 Z% z; C6 ~0 N- J0 e/ scross_marquee.style.left=marqueewidth+8
$ ?  W0 m1 U# s% T4 Y) qcross_marquee.innerHTML=marqueecontent
9 m' t. w0 s- E1 r$ o! `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  [8 G* s, S# Y7 o& X& x( H
}
6 ~; ?# b! B3 C, p' Z* w8 \else if (document.layers){
4 f! G& j; \3 n  kns_marquee=document.ns_marquee.document.ns_marquee23 D5 L' b: {& M! s( A7 t
ns_marquee.left=marqueewidth+8
  ]9 Y3 o% g/ L% `7 Xns_marquee.document.write(marqueecontent)
7 w6 n/ g1 u0 Z2 {- ?( Jns_marquee.document.close()
: d/ G7 X7 u) K2 mactualwidth=ns_marquee.document.width
) h& X- u. t1 P8 [}4 o: i/ ?! f2 \* d
lefttime=setInterval("scrollmarquee()",20)
. }5 Z$ T4 e+ f( [8 [}! S/ ]  ?% h4 i% X9 O' b$ K
window.onload=populate
6 }; B. Y7 ~( F5 v, i! b  _5 f, x  b. E" g; ^/ t: [) S1 s) ~/ r3 \! D
function scrollmarquee(){
8 I! O8 [+ ~' Y2 ]if (iedom){
, a( A. [# N$ o) bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 f2 x. j7 S8 w5 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  j5 k8 x4 A- Jelse
. w* q$ x9 }6 M. Dcross_marquee.style.left=marqueewidth+8$ w* y+ U& E4 F/ I5 `& [8 c
" o* U  N4 C1 y
}5 {# l0 o- c. G, m
else if (document.layers){% L( L  r2 H3 G1 m& X, Y" ]  v
if (ns_marquee.left>(actualwidth*(-1)+8)). P% W( H/ M: ^- _. P
ns_marquee.left-=copyspeed
7 q. U1 `4 v- L0 W3 S4 y9 Belse
3 h) `, g8 y* f' S4 Bns_marquee.left=marqueewidth+8
! R# O' a0 ?' Z& c' R: V3 B}
* c5 U) D2 w& F" D}
1 V4 L% ]. ~1 J1 r$ [
1 D2 E, h$ E: Iif (iedom||document.layers){5 R, l5 H( X! W: J) O/ I6 V- e
with (document){( k3 l) u  v- q1 A5 K% a$ K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): N& a7 m# M6 M' O; H
if (iedom){) u9 v5 x# g+ `5 g/ {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& `/ s' e# o1 P- R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ h' F3 g+ H7 o  b* V1 cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 X4 p" z# W* o& V  U. N% i
write('</div>')1 ^2 L  x* j" x1 w6 V2 r
}5 a9 i8 L( r% R3 K( L, H
else if (document.layers){
9 w- A' o8 I& G! Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 K! e9 N+ V' m) r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( u' o. W% Y$ ?+ qwrite('</ilayer>')  N# _9 R; r8 t) P1 i. \8 W) S; V9 X
}7 |& T/ l. P9 F; a) ^/ I  p# }
document.write('</td></table>')# o6 |6 T. H$ q! U; B4 i
}
8 k* c# Q/ t0 k+ |) C" z}5 ~6 P. o, y$ [
</script>

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