|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
! B6 P( g6 R* Q0 W J/ x2 j- Z$ ?var marqueewidth=3005 i$ ^) i! g& G* }* B8 F6 e
//高度# o: @5 i' ?7 l! D& w
var marqueeheight=25
+ i; y( p4 r" u5 G5 W* }( p! u, D* G//速度(1-10)) C/ L5 V7 S! Q1 o6 f `
var marqueespeed=3
' g9 T8 I! s& R//背景颜色& D5 Q/ t+ q L! ^3 x
var marqueebgcolor="#FFFFFF"
6 P4 f, k7 @! @//是否能暂停 (0=no. 1=yes)?7 n- ?: K0 b( R" v
var pauseit=14 W9 P1 b; R% M8 a& }3 h! |
0 d1 ] C) k3 f' d# x& E9 N! }
//修改显示内容
6 G# w8 _+ a3 o0 g; B/ Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 {& K7 S/ L6 m+ b
! k7 p! ]: I" B6 x$ V
, q9 Y! `9 ~( n# |, ?! u////下面不需改变////////////3 O8 m1 F( `9 Q. F8 x; r
+ e" U% Q5 s% x6 R' e6 t
var copyspeed=marqueespeed
9 H3 |; f' o/ Dvar pausespeed=(pauseit==0)? copyspeed: 0! e' |( N( R) s
var iedom=document.all||document.getElementById
. L- m# R0 }; {/ s0 b ]if (iedom)
2 i" u+ |0 y* f. Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( _% v% ^- H3 X' L+ m
var actualwidth=''
( s' z ?( S) n0 R) D b; p$ avar cross_marquee, ns_marquee
# a5 r. G4 D) Q3 K$ i! o; E' J+ s/ I! F y5 N# O+ L
function populate(){4 l& y( V' _2 k
if (iedom){. g R. P+ r, \, F; X' ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ p# g8 }. H$ T* E% D: i2 Y% Fcross_marquee.style.left=marqueewidth+8
: ]$ Y$ j( h8 J0 O4 y# q; ^cross_marquee.innerHTML=marqueecontent) k7 G2 J0 D& d" r
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) J1 Q t8 r" W9 G) T* l+ [}
* V4 Z3 B6 W9 M- Yelse if (document.layers){
' Y7 r& X, r& W8 zns_marquee=document.ns_marquee.document.ns_marquee29 `5 u @4 X! p* k) S" `
ns_marquee.left=marqueewidth+8* N6 ]2 p0 [9 }- I8 ~# R
ns_marquee.document.write(marqueecontent)
% e2 [" O X, d. gns_marquee.document.close()3 a. B f6 z4 m* q! D
actualwidth=ns_marquee.document.width
% Z% P9 f3 S: ~+ N, C. b: N0 d1 {- r}
: V( E( r3 z" J/ J n5 Vlefttime=setInterval("scrollmarquee()",20)) v$ Q! s4 J7 P6 p
}
. w2 }/ O% c0 @# Q- i- @window.onload=populate
) @( i5 E; B+ B& |
! G) V G% \) ~" Y9 ?function scrollmarquee(){' x6 o% O4 f' F8 i; M
if (iedom){
7 K0 k6 V4 ^ p8 W8 S$ bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 T' p+ \# I2 Q) F7 A4 r, O0 G; \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# d6 _6 S# @" P3 q' N4 x$ [else
+ f% ~; V# \ v/ L) `cross_marquee.style.left=marqueewidth+82 ?. c, O3 b& ^5 r' W
8 _6 ~8 a# g/ ]0 }
}6 b0 @ q. H9 O& i' q
else if (document.layers){
5 n: f" W# V" ^. @7 Oif (ns_marquee.left>(actualwidth*(-1)+8))
/ h0 y N( d2 q' Mns_marquee.left-=copyspeed
0 f5 W: J- Q6 p( M2 I9 Melse! ^, o- s: f8 o6 K
ns_marquee.left=marqueewidth+8; `# ^, g6 l0 ^1 ]
}
2 I# u4 ~3 N" Z; R+ V" @ ?}
+ l# d; m! U1 a" o9 Z+ @0 `0 P5 J- Q! d' Y6 a& g
if (iedom||document.layers){
8 Z: r' D9 a. N1 Vwith (document){2 P8 ?& V! F5 f& p6 K7 I3 j8 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 h, Z; \) G- @, R1 a( Vif (iedom){$ K; E5 s- F, Q. z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 L: V* T& R5 |( ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') P+ F1 t# z) @6 z$ @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& O) S4 s6 ]: rwrite('</div>'), k9 |+ F! e/ ?
}2 R8 S6 Y3 M# i7 i
else if (document.layers){) I2 a3 V" O, }9 ?8 {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') k8 x9 f- P6 L4 J6 I, c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 G1 l$ k- P" }4 J, `. h$ [% s% Zwrite('</ilayer>')
: g6 E$ m! \$ f}' j( F3 [6 Q# o) w
document.write('</td></table>')7 _) E. o0 ?, N2 |' w: r
}
3 A+ }7 }$ R' S0 O3 A+ U}% i3 J, ^% x0 y2 q1 }7 K# z
</script> |
|