返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, d( _$ N: E; h  {2 V$ hvar marqueewidth=300
! T9 |9 j7 }- [8 N& @//高度
% u, G+ s! @0 ?var marqueeheight=25: w7 G/ B6 h& H# p& O9 C  O) Y, N
//速度(1-10)/ P$ M) o  E: ~# k* V0 y
var marqueespeed=3( j% f. x3 a* z" j% c; s* c
//背景颜色5 h4 S4 U. b' Z% Q3 c# o' ]
var marqueebgcolor="#FFFFFF"7 T6 j' j9 @) g" H$ k4 M$ e' B( o+ s* R
//是否能暂停 (0=no. 1=yes)?. V0 g1 `) \2 m" Z/ [9 m% |
var pauseit=1
6 w( J2 @' U6 W' Y) Y0 ^
2 @, }: P+ M# L/ y8 l0 Q) T//修改显示内容+ O8 D4 E: U# J: a  W5 r- n, Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 Z$ q+ J8 S/ Y7 f+ o' \1 O" Q7 ?$ H) w1 a, Z8 @3 q  O* ?
0 c5 k. r; F) S& {7 O1 W1 b% g; R
////下面不需改变////////////; Y: A) l/ ^! Z& \

/ Y' g' x1 ~+ j' Z) n6 `var copyspeed=marqueespeed
- b' y0 P, V3 r- v3 X8 f2 ovar pausespeed=(pauseit==0)? copyspeed: 0
- ~: k3 B5 p& C' [5 A' Jvar iedom=document.all||document.getElementById
9 f/ Z7 L$ K2 A; vif (iedom)
, Z" O0 k' k( P- F1 N$ i! n0 ^( Q/ d# ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 S4 S/ [: D! Gvar actualwidth=''5 F' L( D1 r0 s7 i$ D
var cross_marquee, ns_marquee
4 e; h* Y5 s# U& g& i9 E" i& k) l; Z, }( t$ V
function populate(){
" f  {4 x6 Z( L. o$ p% D% I. {% Vif (iedom){
, A; I3 C- N7 w$ x* M: k+ ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 i/ ^( ]" ~9 u8 Y" [
cross_marquee.style.left=marqueewidth+8
5 l. t& h9 k4 C# A" R3 k5 b  _5 G6 ~cross_marquee.innerHTML=marqueecontent5 T  f) y! |  Q' T) s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 k9 b- k& u5 M* F" D8 \0 g}
. D6 @. m( }/ w+ E( Jelse if (document.layers){
+ x! |) t0 y, p  _, n* X0 E( Ons_marquee=document.ns_marquee.document.ns_marquee2
4 s2 m0 d9 k& R, @6 x% Gns_marquee.left=marqueewidth+8
& }! Y, M! P* H. [+ a- D! Bns_marquee.document.write(marqueecontent)
5 \8 I* x; i& |ns_marquee.document.close()( x! R0 z" J8 W/ ]  s2 [" s
actualwidth=ns_marquee.document.width& v& p+ C+ k0 `2 y2 s+ C
}
3 V" L( Q+ v2 E8 d) b) g- ^lefttime=setInterval("scrollmarquee()",20)" `* f# l2 i9 M2 K7 Z0 D
}- E1 O" P' ~. A
window.onload=populate! m+ n6 y- |+ P; x; Z
/ N) z( f* a+ s, T& w: r# D
function scrollmarquee(){7 A$ F/ V# X$ S1 A2 {/ a! l
if (iedom){1 ]! y% L) M6 d4 l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# V/ D0 P- l- E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( k' F4 P" C9 w% W
else7 Q+ |7 |5 J$ s/ y4 @. l3 f
cross_marquee.style.left=marqueewidth+85 J' f2 D  J) t4 J5 E8 l

2 k/ L5 O* I# [2 C# g8 r}& ^7 i% [5 ]% ~3 t
else if (document.layers){
+ H2 M+ Y0 h4 p" Pif (ns_marquee.left>(actualwidth*(-1)+8))' u$ i( @/ U6 E6 g0 k* U
ns_marquee.left-=copyspeed
, `' R/ t% d/ L. A; relse0 p$ a+ g# M! x7 b
ns_marquee.left=marqueewidth+8
  c# Y3 E' J& W& Z. T8 {}- v9 Z4 m7 {! Q8 e: z2 h
}
; {  @) z! T+ w% v* o
( X6 d. o5 y4 E" E6 \4 Nif (iedom||document.layers){7 B7 q/ N0 P5 _! {$ @3 T% G
with (document){2 i* f7 E6 ~. l9 K( }+ v. T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" F2 D0 {! y' [: j- G2 g- n8 r. Z& s
if (iedom){
) c8 I  y  k/ f3 M6 d! Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ a$ Y- ?- {/ X9 ~$ iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& }, o4 E8 N: _4 \- h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 V& k: O4 @8 N7 dwrite('</div>')1 G6 M4 a6 @' h3 o: x% a
}  v3 h: a$ Y8 G: [4 Q1 c
else if (document.layers){( Q. N, q/ y! J1 x) x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 Q9 g8 \7 d; O5 ~0 N% I4 S4 A& Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 f3 R, a! f8 A" e) hwrite('</ilayer>')  D6 Q% c& P0 i/ J5 h. [* r
}
% R2 h* T5 W' }* C/ bdocument.write('</td></table>')+ e$ O' H: \" h/ m+ i- N+ P
}/ P  E9 V9 S  ^" `  m7 K- v" A4 G
}$ v; B* w8 y  c: _+ x; R5 Q6 |
</script>

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