返回列表 发帖

网页之跑马灯文字特效

//修改宽度( W6 a* z  q9 @) D% P
var marqueewidth=300
$ @5 |8 C1 @: R& F8 G//高度' u6 f0 W2 q7 A/ H5 Z
var marqueeheight=25
5 O* E: J5 g5 }$ e8 n//速度(1-10)9 Y# y' U" j1 C, }
var marqueespeed=3
1 s7 p; }0 C* Y2 w//背景颜色  S* `* p2 E/ {1 ]
var marqueebgcolor="#FFFFFF"
7 d$ M* w; k  b" b  C//是否能暂停 (0=no. 1=yes)?
4 \4 z9 l0 @9 M- G' p+ cvar pauseit=1
* {6 R4 b9 s; Q5 c" F& x6 K3 Z
( Q' t+ ?& I# Y" f4 H  n8 P//修改显示内容$ e) S2 m. G( B) }2 [9 q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', a3 ?0 ^" z" S' G! W
0 e  G& C" Z9 N! M# R* y
5 ?  E- R" g9 g1 B) y$ a0 z' p
////下面不需改变///////////// c  E% o8 b* F$ M
% J1 N( i% \! ]" t2 [3 T' l; z. {
var copyspeed=marqueespeed
3 K$ w/ Q1 Z8 d; h% y# uvar pausespeed=(pauseit==0)? copyspeed: 0
8 G$ s# K. W) j. \- svar iedom=document.all||document.getElementById
, i& d' p8 u4 j# V- qif (iedom)
" j: D: T/ B" V1 }$ I' Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* E2 \8 H; x" S: E3 k- V+ _var actualwidth=''
+ J+ i2 r6 L! `7 Hvar cross_marquee, ns_marquee6 e- k) ~1 R4 t; I- i  z

  c" Y3 M( r& Cfunction populate(){, \! u8 R/ F) j6 U
if (iedom){0 _8 K% [4 q$ U' ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 W/ e! u# y: z5 s% ~/ across_marquee.style.left=marqueewidth+8& r" d- X9 F* |! A* P
cross_marquee.innerHTML=marqueecontent2 e5 |  ?* w) `. W/ @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 s  n8 E8 _+ v) J# c4 s}
- }1 L- r. f% H6 j# W) V9 oelse if (document.layers){
4 \: `3 o5 A* r+ e5 F( a4 O" \ns_marquee=document.ns_marquee.document.ns_marquee2
0 ~+ [8 k" k% Y( ~* |ns_marquee.left=marqueewidth+8  i: \7 {. q1 v+ _" @
ns_marquee.document.write(marqueecontent)1 R$ p) T* Q. |: F  {( S+ h9 {4 A' m
ns_marquee.document.close()
* {( o2 n: T1 {' e& g( C' P8 Pactualwidth=ns_marquee.document.width  u( `$ q; r6 r7 W
}8 c, D9 @) h8 ]$ i* k" B- G% V
lefttime=setInterval("scrollmarquee()",20)& J3 S0 E- }+ G- f( _! R
}
, o4 H) E, ^+ O# f* Nwindow.onload=populate
/ i: P. t# b+ K) ~" x. W- b0 @2 Z5 F" D% z( f& v" I* a- p: r& U0 l
function scrollmarquee(){
  E! [* L+ j+ ~0 I) j/ q$ lif (iedom){& C& w3 J/ g! X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ m* v6 j$ R6 T% F. U2 K/ @* _5 ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 S, L1 O9 i7 _0 |) zelse
& T# Q! [* r) h  U- l" across_marquee.style.left=marqueewidth+8% K: ~- r( l: @' R9 g7 r
1 {/ K. F, s* r9 L. B
}
  h/ J& U1 F, g3 kelse if (document.layers){
/ n/ g7 L! l5 i* i+ vif (ns_marquee.left>(actualwidth*(-1)+8))
. E3 w+ v! X' N/ G# m# S' U& hns_marquee.left-=copyspeed
, C  l! m0 Y: eelse$ ?, S1 t4 g/ P; y) p7 O4 w
ns_marquee.left=marqueewidth+8
5 r# A/ }0 J+ {' a; w6 J3 S}$ g9 K% {! R( B3 d' f1 ]6 o( ?
}2 A8 Q$ X& X% S
- g$ l- Y  E1 t
if (iedom||document.layers){7 z$ Q. B8 O9 p" E) \  N3 F: N  G
with (document){. d: H% A" }+ S# u1 ^. y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* i/ x  F& I- t  ]& ^
if (iedom){8 d) I' S' y6 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- N4 g, n: j! m- v2 a5 Y, M$ h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 L" ]& `+ v6 k+ T/ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 W' m9 F/ D/ t0 X0 o2 ^
write('</div>')
. |1 ?# O) F& j+ z}. k5 p! e$ |9 v  O
else if (document.layers){" P9 `5 f3 ^; U1 X: F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 L* q6 h6 |1 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  f9 n4 e2 v) o( g
write('</ilayer>')8 h5 Q/ l! G6 Q7 j4 Z- H
}& e1 i& X5 d& ?) J5 ?
document.write('</td></table>')" D5 {. k/ m0 k" Y8 o3 G4 Z
}
! q* @, v  i$ w4 _$ w}) i$ O' ?2 E$ u1 @+ |! o$ s
</script>

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