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

|
网页之跑马灯文字特效
//修改宽度
3 d( P4 }' U5 ~$ L! Z% B2 Avar marqueewidth=3005 m% a% g. ~+ S+ t
//高度6 O# o2 Z0 C+ L
var marqueeheight=25
, T/ }/ Z7 V1 j8 Q Q/ v: Z//速度(1-10)
8 J; f$ z7 V9 m; r6 I _var marqueespeed=3
" K: S/ o6 `8 P: T X//背景颜色
- s, N2 k: [5 A( W. V, `var marqueebgcolor="#FFFFFF") p" i& _5 G$ y" H# W
//是否能暂停 (0=no. 1=yes)?
% J* v) I6 X$ }" Evar pauseit=1& c3 n4 g& r. r) B2 J0 z2 g) H
T, W6 A2 d: z( D" E+ Z& D& g//修改显示内容& V# n/ \# u* v7 Q+ J5 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ V0 Q5 M4 x# L8 \7 N* W) r
4 {! {5 w, Y, y8 r( M( ^7 B* O% A$ m) v7 {
////下面不需改变////////////
h; n3 `: [" o/ T
: N: W/ o2 P4 _2 m$ Lvar copyspeed=marqueespeed, R1 }$ K2 n' t- \# H
var pausespeed=(pauseit==0)? copyspeed: 0. R8 L% W. q! [8 O8 m2 w, l
var iedom=document.all||document.getElementById
4 i0 [# _! F5 W; c- f$ {if (iedom)
" ?) Y p& `! u( bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 l8 @3 u$ W* b9 o/ }* L
var actualwidth=''7 \2 M9 E. R+ y! {, a
var cross_marquee, ns_marquee6 ~/ R" D! g' [+ o
! g( j* j6 F! g+ b# G+ t, kfunction populate(){# ]1 S; z' r& O9 h
if (iedom){, ^5 \0 G7 `9 l4 s! @: P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 s" |' n6 U1 e# s8 A: ^cross_marquee.style.left=marqueewidth+8
4 U% S5 Z3 t/ ?/ Pcross_marquee.innerHTML=marqueecontent' V3 U- E# F4 i+ Y6 P7 C' w6 _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 L* B; ?* w5 p" J6 c}2 E/ B. z, c) m+ v! h' a
else if (document.layers){( ]% \- r8 ]9 |
ns_marquee=document.ns_marquee.document.ns_marquee2
! d4 o: g4 g) c$ Qns_marquee.left=marqueewidth+84 |$ ?0 h: ~: ~: v, b
ns_marquee.document.write(marqueecontent)
. P6 R# y/ b* c- w0 Z! m1 Qns_marquee.document.close()1 }6 ^2 Y/ u! w. e+ C* s: w
actualwidth=ns_marquee.document.width4 W" _- f2 d/ G _: h& ]
}
; F' Q3 o+ S8 n: D" Vlefttime=setInterval("scrollmarquee()",20)
1 C6 O5 s+ {$ ^( n2 K1 u8 `}
; P2 s5 f s+ q3 N" ~/ ?! Iwindow.onload=populate6 k( Q6 h: u; W% c/ p
4 Z# m2 V1 H1 H, l H) l$ [
function scrollmarquee(){
1 V0 _: f& R+ D6 A! x" T# bif (iedom){+ r7 [3 S9 O! K& E6 w$ K3 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ I$ A, v5 P4 Z/ Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ I& Y& {+ I( j. \else
7 o: J9 X/ D3 pcross_marquee.style.left=marqueewidth+82 Q! K5 }6 z% B7 h7 ^
' P$ L. {( C( q6 F+ f/ d& L+ B1 @}! E: U3 m9 J* q# A
else if (document.layers){, k( U1 |# j) n; |0 p m1 O
if (ns_marquee.left>(actualwidth*(-1)+8))
. c! l6 z) B3 I! B0 l Pns_marquee.left-=copyspeed
* e* e2 \; ]- E. Uelse
& D" W' L9 b" Ens_marquee.left=marqueewidth+8; F" \& i9 G8 |5 S4 D; z5 f
}
6 e P7 Y7 L8 v2 L$ }}1 o- e3 p7 j& j- |* u
$ D2 u5 u$ v* A2 b9 u7 t$ s8 Z
if (iedom||document.layers){# v2 Q/ o# _/ i0 \
with (document){7 s" M8 G+ n* p$ n5 z) y" _/ K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 }8 x$ o! c4 N0 ]if (iedom){
& w$ Z j4 K7 a/ O$ xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. j1 P# X; Q/ g2 T+ M: B; ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 ?$ N5 U3 L* d' _2 X* ^1 c' r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( U2 f( M* n( q; e2 @- i% [write('</div>')
" b- X+ I! i' s! X$ W}& n( {* N0 Y) C5 l% t& s
else if (document.layers){
! N% F! M! R! l6 Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! l* n9 O& o: S: \+ J3 J J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); Q6 a- b, P5 `, R5 a7 g1 y! Q
write('</ilayer>'); k+ o4 H i6 k. A ^& w, `- c
} ^, b5 r( [0 W: Z
document.write('</td></table>')1 n) A; v9 O$ V
}
3 P; `% b# U. X- h( _" ^! i4 m9 D0 i}
( f% n' j6 z0 b; y; q9 x</script> |
|