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

|
网页之跑马灯文字特效
//修改宽度
6 M! b" e5 A# N$ svar marqueewidth=300
! a' M V) f/ E, H8 S( N//高度/ l4 F0 n5 i# C$ \
var marqueeheight=25; s' E5 n. P' x: [; o! e
//速度(1-10)
3 L, l/ ]! C: W. s8 xvar marqueespeed=3
- @/ \+ g: z1 n- s! k7 V0 Q. V# Y9 b//背景颜色
4 h6 Q- D- _& I$ z7 ivar marqueebgcolor="#FFFFFF"& `/ v' b- A3 M( f# O8 [$ X9 Y
//是否能暂停 (0=no. 1=yes)?( b2 z8 `2 r& o3 J8 l* G0 h
var pauseit=1
# Z6 l- h# }) Z$ y
% h. y6 V! ~) L9 }5 r//修改显示内容
! _- ^& I+ L; f0 D6 Z2 R# Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', g. M5 T F# B$ p! E3 h' q
) z+ T( Q% t0 ]/ Q2 B" o: r
4 a3 w+ C) ]* b. y% l
////下面不需改变////////////2 n8 [& ~% }5 N/ s
5 q0 b( c+ [& m2 tvar copyspeed=marqueespeed
. M4 ?, A, v( ^$ x" _8 gvar pausespeed=(pauseit==0)? copyspeed: 0
W0 d7 Q: ~0 Pvar iedom=document.all||document.getElementById) b" \! z- B9 L6 k6 T7 M3 D4 `$ H: ]
if (iedom)
! g+ \/ S& N: O& }0 Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; n0 {* ?1 S+ |" D( c6 f) v$ }var actualwidth=''6 Y& |7 i' [! J* R' T$ ~
var cross_marquee, ns_marquee
: S5 b% o8 C: m3 `6 S7 h. [3 O
2 q) h3 v9 P# p( O+ O6 Afunction populate(){3 m6 U! Z: X- c# H4 V; J4 y
if (iedom){
' Z" J( t$ Q$ i8 N8 \2 U5 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! C% I) y1 W+ Y
cross_marquee.style.left=marqueewidth+82 M4 @4 m2 |8 h% w* C
cross_marquee.innerHTML=marqueecontent/ `! H# c6 K, n9 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; t- f; b( Q0 \
}
5 U* Q+ k" Q5 Delse if (document.layers){
9 x! _, L. S; n+ Z/ V: ?+ gns_marquee=document.ns_marquee.document.ns_marquee2
7 Q5 i; T) b y+ kns_marquee.left=marqueewidth+8( g" w. z1 R. v+ \- F- V* Q
ns_marquee.document.write(marqueecontent)
* n6 c0 c5 G u' F6 G" o( a- Y6 ]7 tns_marquee.document.close()! T3 O. E0 T, _6 w. Q5 a) B4 a
actualwidth=ns_marquee.document.width% M' W. j) W; N* K; v
}$ Q$ J) `+ J( l ^+ T$ i
lefttime=setInterval("scrollmarquee()",20)$ l/ d4 }3 p+ Z% {: Q4 `
}, o! u+ C; R5 l- e9 {9 E8 s4 b
window.onload=populate( g$ a1 g1 H& x
& N6 C' L) Q5 o) S8 N
function scrollmarquee(){
* ^ q" f l5 t" a. Z& k' u1 `+ jif (iedom){
3 p% V5 Z# z5 S$ {, Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ i& G: |- D& g% S) x0 L" q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ L, p' G% V9 A+ A' T8 oelse
' u C0 R* m/ @; x( Q- Tcross_marquee.style.left=marqueewidth+8) G- A8 T) _2 q# }, @9 C' X
s- {" r5 R9 t( t6 m# y}
6 c; f5 [% t" r8 u2 o! belse if (document.layers){
: |# P7 P. {$ F( ?( B: `/ z- m7 Zif (ns_marquee.left>(actualwidth*(-1)+8))
+ j* a: r! |7 F! Z+ P lns_marquee.left-=copyspeed
0 T. C# l/ @. e$ d ]- O9 J/ Velse8 S4 @) e; f3 @ X
ns_marquee.left=marqueewidth+8( G- r3 }9 J: Z$ g
}; |! Z: s; M/ o
}
8 m6 @, s8 F5 W) O. T/ S, x! z6 z j* F, x9 K! U5 J4 j% n% k: U" k
if (iedom||document.layers){
! e: c2 W# B2 p; r# kwith (document){4 g! \+ U0 r. V5 k2 z2 e$ X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" [3 O4 w" m6 ^2 t( k' Aif (iedom){
3 R2 H: l% A* W1 Z! ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 `% B* Y3 ~6 d0 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 N9 c/ K0 b2 N* l3 n; \ {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& g2 d8 G" y' s9 x* dwrite('</div>')9 X2 x- I( _8 [3 ^% w+ H
}
1 K( C3 A0 E- e0 w- Lelse if (document.layers){: R7 K+ q+ `5 _: H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 ~% q# W% w6 y) `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ T! `! N% h: N2 R# j/ ywrite('</ilayer>')- E8 ]/ x) a/ P! h
}& r) ~, d$ `7 ]; u
document.write('</td></table>')" W* W9 c; D5 h2 q- p
}3 h) f4 y; Z8 U1 K+ w
}
' N$ G5 R1 Y2 Z- f$ ~</script> |
|