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

|
网页之跑马灯文字特效
//修改宽度
0 `- K) f- |# g {3 ^; L) {, xvar marqueewidth=300
+ D7 c# i: H5 P* h! a//高度" K, q, p {: h7 V& v* L
var marqueeheight=25
; I+ q- O* u/ C# |//速度(1-10); D* [4 J3 z* ]* G! _/ r X
var marqueespeed=3, z6 R+ P/ W5 j6 L. ^8 q! T! B& G! q
//背景颜色- H4 L& w6 Z8 t$ S1 W0 ?
var marqueebgcolor="#FFFFFF", b" l0 ~6 @. g- V m
//是否能暂停 (0=no. 1=yes)?; H/ f5 t$ O( W+ p& k
var pauseit=1
+ I. t) u3 ^- L& g. u+ o7 [4 ~
/ j W+ d" F$ c8 m4 q2 C//修改显示内容6 R2 |6 m9 {+ v: a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 S: q) f% c% J+ |3 S; _( D1 ]$ }$ g" l% Y
$ {7 ]$ H# G! }4 s U i
////下面不需改变////////////, W$ F+ o4 V1 F9 @2 T$ }0 _1 M& {$ F
+ o3 G- `" v) J$ V, c( D; ]
var copyspeed=marqueespeed
) V# C2 ]' L; k0 Zvar pausespeed=(pauseit==0)? copyspeed: 0
- X4 c' e1 D, N; gvar iedom=document.all||document.getElementById
$ [% ^5 {" ^9 |2 ]8 ?$ M/ s3 Fif (iedom)1 J/ V% Y" M$ R, C' C4 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# Q k3 \: L2 _; Fvar actualwidth=''
# a% T0 q4 u5 \' v6 T8 D lvar cross_marquee, ns_marquee m6 z% u0 i( E
/ l( z! R* \) P: W
function populate(){+ z7 \( X/ b, a0 r% Z# t/ d2 ^
if (iedom){
# z; y8 o6 x) Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) \& R; D7 O" Y. [5 K& N1 c. kcross_marquee.style.left=marqueewidth+8& J3 V' y8 P8 B
cross_marquee.innerHTML=marqueecontent- w0 m5 s3 b7 X5 l& m+ \, ^9 j& J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) U+ r5 D0 {' g5 ~6 T}
/ j4 A% @6 E5 }/ ~- U* kelse if (document.layers){8 \) i9 Z w1 C2 k+ r% ~2 j
ns_marquee=document.ns_marquee.document.ns_marquee2
$ O3 v" ` d9 b: j; J5 ]8 k* |ns_marquee.left=marqueewidth+8' [. t3 v" g: i* q/ L4 w; N, h
ns_marquee.document.write(marqueecontent)
! | F3 C# N9 C# L0 E! sns_marquee.document.close()
9 W/ y/ y9 P0 X; K/ m* |actualwidth=ns_marquee.document.width
9 H7 {9 u$ _# w# q2 f8 [}* C' ^# D* \% l3 D: i3 K
lefttime=setInterval("scrollmarquee()",20)
# e: N8 t: i% ~. P}, R. c. F; k) K3 Y4 W( l2 T
window.onload=populate
' D" }6 c+ \( ~, i
# r+ c! C5 q( I0 R: p2 [function scrollmarquee(){
6 y. ~" s9 V$ S! z; ~# Z' Jif (iedom){# f# S' J* x1 \+ a# T, T2 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# m# E6 L7 t* ?4 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* B" d! ^8 y: m5 z" k; x% L- ^
else. u( i6 x$ Z4 ]& n' i
cross_marquee.style.left=marqueewidth+8
8 j$ g% g! d: J- F
+ H: ]6 s4 F* d4 b g0 d- L}5 a* _7 o3 u( o& G
else if (document.layers){5 T' O% R2 h$ l) N4 _# G2 z
if (ns_marquee.left>(actualwidth*(-1)+8))4 D2 k5 L9 l6 L% x7 S$ M
ns_marquee.left-=copyspeed5 O! h) a* C% }6 O1 c
else
0 C4 D1 _8 d0 _' s: Q" `5 Y; \0 ?ns_marquee.left=marqueewidth+8
" W7 x, h; r `, t}
/ D3 w6 \" p( a9 b- s, S2 l3 Q}3 I$ O/ p Q) g. l& R, H8 n+ _$ c
$ ^5 w6 P8 j' ~% o" U8 {
if (iedom||document.layers){; Z7 S7 W8 V q- ^* F
with (document){7 o! B; ]4 A7 k4 u% p2 I- }/ {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' u; h$ i- K* o: l) g
if (iedom){+ L7 [1 w/ I. d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 \3 G/ \ r+ p6 F, }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 X5 C# O5 H+ J# }' B( J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
T( a7 T. P. p- ^5 E; Qwrite('</div>')
' D# A N, h" G* ^/ n5 `}
- @7 X7 E8 B4 |$ q: Q1 T& felse if (document.layers){; e( e) d K" S0 V! }- w n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), | z K. ] t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ B/ U. g0 Y8 X' ~9 h: twrite('</ilayer>')5 Q( v- i0 n& L, c( a
}2 C2 s/ d2 i, s5 y! F
document.write('</td></table>')
! f9 ~+ C- T- \$ ]9 i/ E8 M7 Q: C) n}
* H$ U7 K" |5 d, G6 U& U% _}/ O- w* g0 T6 `2 B% b1 n! Z
</script> |
|