返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# e- w1 l1 E& ]% B0 }, Kvar marqueewidth=3008 ^4 U4 V% K/ |3 Q- y! O) Z  s$ }
//高度
; Q  Z% A( P0 {3 k7 E$ t  C8 ^, Zvar marqueeheight=25( C, C8 ^6 N# P3 J0 E% _4 \
//速度(1-10)% ?& V! T4 m, B3 ?1 B
var marqueespeed=3% U, W$ r' Y  n! p
//背景颜色
) A, R- p; \# R' Q5 F8 t$ m. Ivar marqueebgcolor="#FFFFFF"; P! b- P2 ?/ Q& C( C
//是否能暂停 (0=no. 1=yes)?
, q: b+ L1 Q5 z/ f# a" I# Uvar pauseit=1
. Q& K9 T- R8 ?
+ q  K; ~/ y" h5 {//修改显示内容
9 o- {, ?' \0 p% G8 tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! i1 O8 A& f% P: z0 J  r) a1 M
. t7 R! q' r9 p  g; f8 b  Q* m( k! r) a  h) n
////下面不需改变////////////) ~2 c: z$ q1 ~% o. B, {
7 U* c. s& u: j2 u
var copyspeed=marqueespeed
2 j! s+ G0 U" }' R: Qvar pausespeed=(pauseit==0)? copyspeed: 0& G; x" l- q7 T( W& E
var iedom=document.all||document.getElementById: q) L) H) M9 i8 K, d" {
if (iedom)
9 Q  y+ G9 O$ i3 Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 _4 g/ }2 L+ r$ u2 Gvar actualwidth=''
1 L0 v# h* U" l  q! xvar cross_marquee, ns_marquee
! R7 Q; J+ \2 ]/ U# w) d  V3 D1 ~2 y6 G+ B' k5 Z
function populate(){
2 [. N+ N+ o7 b' S2 v% y* `if (iedom){
% X5 N4 L* B0 `' W( }9 Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 E7 ^0 N2 S5 q6 q. r, _# W/ V
cross_marquee.style.left=marqueewidth+8
2 |9 M6 j. m2 Rcross_marquee.innerHTML=marqueecontent9 L. E3 r! Q! a, p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 {- g5 c- i7 m" v  v8 A
}/ J* _- m1 H/ o
else if (document.layers){, r3 c8 Q% I$ ~+ C* k2 ]
ns_marquee=document.ns_marquee.document.ns_marquee2
5 G: b* F7 A) s5 l) Vns_marquee.left=marqueewidth+88 ]) [. {' g: o
ns_marquee.document.write(marqueecontent)
/ M6 W( ]4 }2 Dns_marquee.document.close()
- D! D4 h3 l  G  U9 D5 cactualwidth=ns_marquee.document.width
$ U! H. u/ F7 S" q& x0 p: I}
3 {7 i+ Y, o$ [2 _+ F% x' }lefttime=setInterval("scrollmarquee()",20)$ E* K0 q8 l9 v  \! u6 U
}% Y7 p0 l- g2 Q- B
window.onload=populate) V  b' V9 ^7 r
3 ?8 f0 Q* A1 w1 B( }3 I
function scrollmarquee(){! s0 Y8 p9 S2 K$ G8 L1 Y
if (iedom){! U" |; ~0 M' {! P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) L* Y7 E0 Y. a- Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( B" y0 U+ Z3 P8 L& }+ I# }3 U3 {else. `; g! S; g1 t8 R$ n  H5 G( V/ f7 i
cross_marquee.style.left=marqueewidth+8
+ Z8 i( ^: B& J3 @0 f3 f9 R  ^  f" w$ [4 I8 s/ p
}6 `* v3 @- b! {0 x4 S; z) z
else if (document.layers){
7 @. @, M& o8 H: q6 iif (ns_marquee.left>(actualwidth*(-1)+8))
# }7 d6 k6 G7 e! X2 Wns_marquee.left-=copyspeed: \$ X) M. {. Y
else
2 C: j) i1 K$ A8 [. cns_marquee.left=marqueewidth+81 O# B0 {1 y) I8 p
}
. v1 `6 W: U9 X  E  l5 q}
, O$ }" A* P# b6 F4 \: F
% ~. g: `  a  i3 jif (iedom||document.layers){
$ m+ b& n- A- q- P& M/ @with (document){
1 G9 s) \+ C5 p; p# hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 n9 E5 k  Y* G0 w2 A
if (iedom){
6 n5 ^6 k( N! T) wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ ^. b6 r; A" o" m! q8 p7 u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ Z) S3 _9 G) G& ^# g. U6 F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, o, [+ L9 X1 E3 dwrite('</div>')
$ o( \- C9 `6 x- ?}  \3 J" g7 {% h; l$ ~5 r! U4 p( x
else if (document.layers){
0 _- d/ u5 _6 |" b: D* {7 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' X8 X  I$ k: H* F7 u% g' {$ z- y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): ]: v3 d& G; \. g. P1 T' J
write('</ilayer>')
( H$ [: A. i! l# i}
) R( W5 M0 ~& F! ]7 {document.write('</td></table>')1 p' u& c/ S& D
}
$ V5 [, T# S; @# L/ L( |* O! O}9 r5 x0 j, w& ?. ]8 S  x1 U
</script>

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