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

|
网页之跑马灯文字特效
//修改宽度
3 m4 j# b" f0 s& o% i+ q0 L7 Zvar marqueewidth=300
4 X, p2 }& f0 _& ]3 K//高度
/ X h* i6 ?# J( cvar marqueeheight=25
/ _% g# X$ t" o5 G6 Q: j//速度(1-10)$ Y4 p- G; X4 Q2 ~" V4 n
var marqueespeed=38 U, Q( U$ d( H5 R, W
//背景颜色
* U9 U: C" b8 j6 k# Avar marqueebgcolor="#FFFFFF"1 v. }$ F7 Q6 [; k1 h3 U$ K$ [
//是否能暂停 (0=no. 1=yes)?
- F1 w8 Z9 X: A9 Cvar pauseit=1
' t* P8 _8 c5 l( N1 g
, s9 K( S5 ?1 g( @0 Z7 H S5 d//修改显示内容$ c$ y+ e( v" L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 w- c, f# }6 t1 Z8 z; l4 f7 d. H
# s" Z8 T) P9 H [ q. v+ K, M9 p, `/ `7 D
////下面不需改变////////////5 @9 h5 s* l5 g! s! w+ ]! Y( F
0 ? S) F: T# i; ~9 b" Cvar copyspeed=marqueespeed
! _+ `) }. G i+ m/ o+ cvar pausespeed=(pauseit==0)? copyspeed: 0
, {7 c7 c% ]' Z, rvar iedom=document.all||document.getElementById
/ T1 V- s) \% K4 \- q! D; z9 f2 Cif (iedom); W( k3 h& a: p k2 y- o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# A3 Y. q% }5 `; X$ `. A I1 jvar actualwidth=''
' m4 N$ [ j9 r. Xvar cross_marquee, ns_marquee
% n4 f( n6 ?( Y& ~) p* |8 k' {' @5 B7 Q( }7 G( I& }
function populate(){
% `9 r( K) d- {9 `! L* ?if (iedom){) N- ]- y9 B! l q# l* p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 V7 d6 ?7 Z0 ]7 ]9 G3 Ucross_marquee.style.left=marqueewidth+8
+ J; f! k. S( P& K3 ^1 ~: ecross_marquee.innerHTML=marqueecontent
; v( \) m/ }9 r. K7 t" D3 C4 f5 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ k9 ~% G- P" L
}
; \, V$ ^: F7 h; X; q# H! C8 E6 Delse if (document.layers){; l9 m- O* D" m% I
ns_marquee=document.ns_marquee.document.ns_marquee2; }8 n+ S9 U6 Q
ns_marquee.left=marqueewidth+8
: A6 s2 n& p1 t$ @- ^ns_marquee.document.write(marqueecontent)6 x8 s' S/ G2 I) c
ns_marquee.document.close()
2 e9 k* K6 t- F: ]5 L" Sactualwidth=ns_marquee.document.width
( X1 T9 x6 c# l' J0 P9 w}
& B* \0 d O: u5 W# S: L# s: blefttime=setInterval("scrollmarquee()",20)3 T( P! T: I0 p+ c9 x+ n1 I
}9 g; E1 h( B" Z8 ]' a7 V' y
window.onload=populate' u* o- u4 }5 d
1 M4 Z8 u0 A: t# I: {1 r# y
function scrollmarquee(){; d1 g6 l$ r- n
if (iedom){
! T* E' G2 s: X3 c) Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) f$ E8 n* v, `& H8 J+ d0 x2 x" _' E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; a9 U+ k: K& @; f. velse
: X' h5 W' X3 ^7 C5 p+ f! v& K# V kcross_marquee.style.left=marqueewidth+82 s+ \" b7 o- f) U; `3 D. f& D
' }' B+ e! S* B" X% D6 \' z& ]}
t* V6 D6 I0 a( Xelse if (document.layers){ C; m ]9 y2 s" ?( e: o
if (ns_marquee.left>(actualwidth*(-1)+8))
1 h( M( Q! ]% ?# k6 kns_marquee.left-=copyspeed7 P/ U( |5 \8 c9 G( w
else
/ Q# Q1 Z! E7 U$ p2 b8 P" l1 ^& Yns_marquee.left=marqueewidth+8
9 s! X q9 i" T8 z. ?9 Z}0 H5 H3 c! n* V" \! f3 d2 A% W
}" b: b/ w1 [8 ~: E5 |
3 m5 i! f7 E: g: Z0 k* O( P+ uif (iedom||document.layers){
0 Z! E f8 d5 pwith (document){; s2 u8 g2 e: u5 Z! N) s2 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 o9 N! |3 H; K& E7 }( U$ kif (iedom){
' O4 K4 s/ z8 R5 A0 i( ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 x; g/ i# i' B- E4 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ y! C( i8 x ]3 S( h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& S$ u, y J' p2 } h
write('</div>')
5 M/ d+ C u4 d( }1 ^) ~}
3 ?% X7 c# H/ I. felse if (document.layers){
- B6 J1 y: I1 }6 `9 l0 Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' u9 w0 j: ]! [8 x0 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. E- o$ k! J" q! {6 u, Mwrite('</ilayer>')
1 f% q9 D0 O6 c# ?" n+ `' {}
* R/ G& `# ^/ {) pdocument.write('</td></table>'); [# v! B2 h, N' d, H0 G2 j, _
}" l3 o" H4 u% F' K/ N
}2 y7 H, @& h+ P
</script> |
|