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

|
网页之跑马灯文字特效
//修改宽度
* O; P T6 J7 }$ vvar marqueewidth=300
- p8 I- Z- S5 Y: K+ T//高度: C' y7 K8 A. Z' n" G; ]5 l2 c
var marqueeheight=25' s1 ^+ V, |3 d: n
//速度(1-10)7 D- m8 ^/ m% F; k+ A5 {, F
var marqueespeed=35 V. b) u) m( a
//背景颜色
& b) N; }3 S. R. P2 B/ Q+ `var marqueebgcolor="#FFFFFF"
/ e8 E J) G g& l//是否能暂停 (0=no. 1=yes)?
% g: y' V& a2 A B& f0 ~% E8 cvar pauseit=1! n1 r x0 i" i$ v
8 e; O# Z# c1 g7 _" Q" `//修改显示内容1 U" B2 m ^1 p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# P5 x0 P# k4 m: g# ?- E" S) y5 X8 b( G3 r; \3 C3 E
3 [0 o9 s C6 W" @
////下面不需改变////////////
' ]9 A% e" r I
`3 C& u- H0 Q( ]5 Z# Vvar copyspeed=marqueespeed
. o% ~8 B5 o: R m* P5 {$ _! {var pausespeed=(pauseit==0)? copyspeed: 0
, Q Q2 k7 n! qvar iedom=document.all||document.getElementById" k$ T2 g5 _* ^. [, g' H3 ?
if (iedom)
* z4 l6 D7 S6 V0 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). B% }. U2 G# d! r2 P' \, R
var actualwidth=''0 h* g$ r* d' z' ]7 P
var cross_marquee, ns_marquee
7 W) p: }' z' \
7 p5 s+ O" t' h, V0 m( n2 Afunction populate(){
, E1 Z6 G* I3 ^- D* Nif (iedom){
9 ^2 B2 z8 }$ ~, E; f) L2 n j# _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& i" Q( F9 S" \/ ?+ C9 d8 Dcross_marquee.style.left=marqueewidth+8
/ V- ]7 O# p+ p7 j" d# mcross_marquee.innerHTML=marqueecontent) R1 x Q' R& R/ I; E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 u( Y2 I3 ^& W, A. v6 V! ]
}
! `( n# i" `) Delse if (document.layers){
; S$ s( }8 N0 D5 i& jns_marquee=document.ns_marquee.document.ns_marquee2
% D' [( U) z: n8 Y) ]3 ~: \ns_marquee.left=marqueewidth+8
% e* A/ G$ l4 j0 H+ J& e# ]/ E. ons_marquee.document.write(marqueecontent). P; b# K% s0 ]
ns_marquee.document.close()+ |! z$ s; S" i' l
actualwidth=ns_marquee.document.width* m5 [% S0 S2 S, F+ _/ r q
}9 S* _9 | N) p
lefttime=setInterval("scrollmarquee()",20)
3 b' ]9 q% u& {1 ~}; l7 s- z$ B6 z, s* L% q
window.onload=populate
: A' g& E6 L& ~; x' A5 G/ s' C, u# j( [: j; R0 `5 ]4 }. h2 ~
function scrollmarquee(){1 ]" f8 v6 P- p" i
if (iedom){
1 W+ i: L( j# _/ V& Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) _0 O. u t# N7 X; Z, \( i9 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed K5 g& B, d1 [- G8 n' S; J
else
! A0 l. U/ ^" w% _cross_marquee.style.left=marqueewidth+8
# Q' F8 v+ G2 h. ?8 L" W( n( E. \" {# {% p
}+ V/ G- s) ~/ k o
else if (document.layers){
+ ~- L0 l/ q0 i: Nif (ns_marquee.left>(actualwidth*(-1)+8))
4 ]4 d* C4 ~! k$ W' O. m8 K1 X+ b7 p- L4 T0 tns_marquee.left-=copyspeed/ Q" [* z) X2 i* R: g4 z
else& ]) J) ^' y+ v2 z" W1 G
ns_marquee.left=marqueewidth+86 h) m' M! a) X; |' s1 s
}
g# d2 a9 ^: [" v4 H}2 I: B8 U* M& w6 c. N
3 O3 P. O3 J9 {0 [if (iedom||document.layers){! H4 d4 R' {! O! c# K
with (document){$ M3 X, @2 D/ A2 g0 I8 {- E% S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 a2 e8 [! h) _, ?" z4 Z
if (iedom){
' z' T/ e7 E6 ~0 X4 f; M" G" Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# M" b* s6 ^& c' c, \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 P# H, i$ f! ]3 L2 Y6 \* x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 T+ ~0 s' n( M6 f+ @5 l
write('</div>')
3 y; Z+ J8 b$ ^) O}! B; F/ ~8 \2 y/ C9 ?3 p2 w1 e9 V
else if (document.layers){6 S1 @2 M7 |% y& K; J: I# _0 A1 A% @( e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 I8 A6 Y. x6 N( }6 L# k* x7 n5 ^ t5 Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') D% S, ~$ U/ s; d
write('</ilayer>')
3 X7 B, F9 K, k9 p) S& {7 y5 y}
8 H/ f5 U3 ?# O7 odocument.write('</td></table>'). X6 L, u" D8 ]" n! s' [* s
}2 r, q3 a: c% K/ E
}
5 }" i$ H* Z/ K: i5 p. O9 O</script> |
|