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

|
网页之跑马灯文字特效
//修改宽度
5 P ~! l/ ?9 |) @/ u; }3 Z9 m/ D" evar marqueewidth=3004 B, R+ g! p5 F8 M7 O
//高度2 Q* X( M! J4 x: L; v
var marqueeheight=25+ V" d+ [* V! w+ b, P6 g
//速度(1-10)0 L" X3 d, ]! H ]
var marqueespeed=38 E0 @. H) n# G* t( n' L/ l
//背景颜色
# [* Z2 p! ?+ w3 |: Ivar marqueebgcolor="#FFFFFF") ^; U$ N' Q4 G& o C! h$ r
//是否能暂停 (0=no. 1=yes)?( |! h0 d4 r: v. D- N% U
var pauseit=1
) _4 Y+ _" I1 h& @" N- X# g1 C$ e p5 K3 M
//修改显示内容" U; r6 B, x. A+ H1 n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. W( S: ?- t. P6 z* d. N7 V, ]3 `% F2 o3 k5 Z) X$ c
# E) M% \' B1 F- Z" N! q0 U////下面不需改变////////////3 F4 R- w$ B. h7 Q* b: M
# k' c& \) B g* P( k3 j1 Ovar copyspeed=marqueespeed
1 n* @% t# v9 O3 Bvar pausespeed=(pauseit==0)? copyspeed: 0
# o( H! b, _1 L8 w0 k f' Z/ Ovar iedom=document.all||document.getElementById
+ a$ ~0 `7 m1 h8 Q) m ^ [if (iedom)
$ R! d, b8 Y m3 {* ]/ D' ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). c7 w: `, a. }5 h1 c' H, k
var actualwidth=''
! ~* F' Y( C# A0 q: Pvar cross_marquee, ns_marquee* t5 S8 F; X! i) q8 a1 i9 n0 j+ L
( \) [ U0 ]2 y$ C$ ~, X
function populate(){2 O; a+ S% w2 t$ S6 p
if (iedom){7 w6 ~2 v- z& Z% s1 ]. h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 i9 n# l) _* S1 `' o. | d
cross_marquee.style.left=marqueewidth+8
/ |$ F: d8 W) [4 S" \cross_marquee.innerHTML=marqueecontent! a. D6 W! s" [: H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 A6 A0 x: Y1 _$ t: X}
$ h3 h- f9 }$ C2 _5 telse if (document.layers){( E+ n% v H6 M; d! h; Z2 n
ns_marquee=document.ns_marquee.document.ns_marquee2
4 ~- i7 K, b0 L7 bns_marquee.left=marqueewidth+8% h, P4 ]8 m* [* b
ns_marquee.document.write(marqueecontent)
1 ^! O! R1 Z# R8 S# sns_marquee.document.close()
5 w' |( k+ k3 h+ n( Z% Xactualwidth=ns_marquee.document.width4 S. o. t9 o& E" i
}' q( X+ w% v4 ?1 j; u
lefttime=setInterval("scrollmarquee()",20)
) ]) D: C$ v, u, p3 L. w}
5 f$ X% [6 E U3 C* `0 pwindow.onload=populate
- {! u0 f+ ~$ d4 j: m8 ?( a, T; Q0 u: n [% Q" @: _
function scrollmarquee(){
/ {" f8 G. E( x1 [. |+ x6 Vif (iedom){! ]2 _, R, m/ F& g0 P9 n4 u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! Q P' C0 \2 \6 s2 t# h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 g+ [& V9 J( J2 \" Jelse
* P: M& r& W9 F8 z' n1 C5 ncross_marquee.style.left=marqueewidth+8
( k* I# J1 d3 G5 @3 u7 m( o4 X8 L6 B( L+ B& k; H( s2 m
}
3 }+ A1 ~5 M: n4 v8 o/ Yelse if (document.layers){
( W& T8 V" M1 Z$ [4 M& pif (ns_marquee.left>(actualwidth*(-1)+8))' O; C3 B" {" u/ Y9 U2 c
ns_marquee.left-=copyspeed
+ X& L- B' S. T1 [: jelse1 d8 ^3 c0 ~6 w: _
ns_marquee.left=marqueewidth+82 C- y5 Q) M9 s/ J
}
8 ^6 E0 {2 K% @4 R! H2 T' W}( i/ W+ S: R1 a( P0 r9 N
/ E" Z1 ~. X: c& l; a( N, G6 Pif (iedom||document.layers){
+ D8 t+ @' G# s$ X% H# Uwith (document){
( o0 c$ a, ^/ D1 k" Q$ ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); e$ @8 r5 z* N2 G8 \+ ^+ A
if (iedom){) p6 @, @6 S* ^$ t' V1 u3 [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. P* q: @. k6 j6 k5 |- X- G5 k+ Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ B; `6 C2 _: t' U# Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 f/ s+ S7 X; j8 m' B5 w( \write('</div>')+ `3 N0 H; |* `' \8 y- u! H+ z# A
}% M( d$ N4 ?+ C# @3 y6 S
else if (document.layers){3 {* ]3 z- _8 U7 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 _8 J; X4 u- p1 f, W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. J1 n* g, x$ h* d2 kwrite('</ilayer>')
# \. D, {" x% c! F a}
t2 L! M( d u/ E F6 y0 pdocument.write('</td></table>')
7 [) e( s. W! s5 n5 y}* Y/ ]. z- K, p# }
} }% l/ H( w& @' m, g& u4 L0 X
</script> |
|