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

|
网页之跑马灯文字特效
//修改宽度
! f: R$ h8 d3 A% `8 Fvar marqueewidth=300
/ _, ]# v, ?4 u- T8 ~4 M+ b! s; F//高度1 l5 |1 P U) O
var marqueeheight=252 k2 ^" M0 e1 c9 x ?; i
//速度(1-10)+ |6 S1 Y6 h: v: w2 O) _
var marqueespeed=35 y/ W8 h7 [( k' Q- y# \- M
//背景颜色5 n; A( W0 t5 e- k
var marqueebgcolor="#FFFFFF" X: I/ k# o; R/ L
//是否能暂停 (0=no. 1=yes)?! u, a" F- c0 |" w0 [
var pauseit=1. w1 n' q7 x! S4 O! v5 h
/ r8 F$ I2 L- j0 W: V2 B
//修改显示内容
& z2 I! a; J1 [! `5 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* i$ a8 S3 F5 N6 _7 b0 M8 I& l/ W9 _1 r
( i/ ^. {! J' Q////下面不需改变////////////9 m' K) e$ m! s/ A3 J: }9 H
, F! h8 O8 |( ^8 S, a0 e
var copyspeed=marqueespeed
% M$ a; }/ Q2 S X; b' b9 G( {var pausespeed=(pauseit==0)? copyspeed: 0% W" u+ b5 d# R0 u
var iedom=document.all||document.getElementById
" o& L; ]) o, q' ^' Gif (iedom)
1 _! u y; G; n" G5 t& f% edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* Q9 u9 [& O( _; uvar actualwidth=''
& A1 J# P0 r1 Avar cross_marquee, ns_marquee
. M: j6 p6 V( k' ` b7 R
0 D _% M: n ]# n8 w! o7 Zfunction populate(){
9 K% h( I3 x9 g2 Zif (iedom){
- B# t; i! u8 F0 ^! y( Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; F2 n: n. E8 M# y0 r
cross_marquee.style.left=marqueewidth+8$ h& i! l% N* d* Q) l
cross_marquee.innerHTML=marqueecontent' |1 ?8 R. A+ |& G1 | H4 Y0 g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* j3 n2 `! F. Y, B2 @1 L' n
}/ G$ r0 e5 B5 F0 H8 z$ g0 {
else if (document.layers){/ }( o/ F0 {9 I/ d; |: ~
ns_marquee=document.ns_marquee.document.ns_marquee2
E# ^/ x9 x8 F6 r. X6 A2 r. Yns_marquee.left=marqueewidth+8
8 c3 A0 F# j' H: B" _! p& Yns_marquee.document.write(marqueecontent)
0 c0 L; Z# I# x! j+ [& |ns_marquee.document.close()
1 ]* y. ] k4 x6 W9 P$ N3 Gactualwidth=ns_marquee.document.width! L# F. q- Q$ K+ T+ H1 K! W5 S
}* Y) B0 F: v% p, g) j1 Y- t( u
lefttime=setInterval("scrollmarquee()",20)
& y* `' f6 J, l2 l+ f3 \}& \% V/ w! T. P3 }* J1 M" }3 i
window.onload=populate3 u7 [* p2 B# o1 I, @" ?% {
. z5 o' V6 A4 V: d C( X$ q
function scrollmarquee(){- {* e `% P2 d! J, ^7 `, I4 E
if (iedom){
+ T$ Z( u. Z( oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ G1 v9 a# J. m/ ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. _8 \0 n$ Y, S
else
3 i% N' F( _/ G6 U2 }; P+ Mcross_marquee.style.left=marqueewidth+8" R. J' q+ J4 R5 Y5 d
- ]5 _; n0 e& _0 `% |/ E' ]
}
0 K( k' O/ C! S, l6 @else if (document.layers){
$ B% \/ D2 p+ c2 t8 n( h2 q4 Q( uif (ns_marquee.left>(actualwidth*(-1)+8))
9 W( n1 k! g. c$ Bns_marquee.left-=copyspeed" l% d5 S L% ^- A% _8 {$ c1 @1 |
else
% j) L7 |% f/ O$ a. ]ns_marquee.left=marqueewidth+8
; m0 ]3 }" k: A$ @}
0 R! i" \. c8 ]# g- J b1 e% G+ N! \}( P: a6 {" [, t9 r; g+ D- o! B
9 H* |' v' T, d q' x& a- T2 p
if (iedom||document.layers){7 d# s4 y1 Y6 C5 O# k+ I; H
with (document){
( a: B! v9 B1 H9 L. l' }% o. ]+ Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ }$ L" x& M V( `if (iedom){
9 `$ `" o" z) t, Y* M5 | H# @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); }- n& x. m) _/ b" _% u9 I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 E/ x1 b J5 x* U/ [0 b: ]' o, h$ r7 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, G4 }3 X7 |& o6 ]9 mwrite('</div>')% S; d( E: ^! }9 W' ?
}% }4 o6 A2 r: K; f6 o' V3 p+ O
else if (document.layers){
! d- E0 L3 l! z$ y2 P4 wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( G3 @& K- P1 F/ R3 C- ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, X6 _. l6 b9 d8 l, a4 G( Uwrite('</ilayer>')4 g7 A5 R, `. h" w* H3 `
}5 C! N. @- S4 u" u" t
document.write('</td></table>')4 l% o+ E% t* ?+ k2 W
}
& w3 ?4 S7 ]" K}# H3 N+ Q+ G# ]2 X
</script> |
|