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

|
网页之跑马灯文字特效
//修改宽度& K7 V( j2 i7 h" {
var marqueewidth=3009 Q% L: Q$ K2 [3 @- ^
//高度
9 _: M) d) ]9 _# H) r; y8 kvar marqueeheight=25
; w# U. g- U3 X, O' T//速度(1-10)* U$ `% C2 y% A& d' j" P' `
var marqueespeed=36 K7 r- Y/ o0 t" u$ I( i4 \
//背景颜色( i; [ a1 e" A9 }, }4 t
var marqueebgcolor="#FFFFFF"
) f3 I* T& D8 p& m$ o" U7 b//是否能暂停 (0=no. 1=yes)?
% q6 f7 Q1 [8 U. k) z5 j6 fvar pauseit=1) M+ g! U1 M1 ~6 ?5 M
9 D0 L3 i/ F' ^4 U" h9 |//修改显示内容
4 H6 y; ~) a, v. q% j V, Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 R* V, h$ v- e* V% p( A) b! g7 p
2 u' q! c- M, q' \. q
0 a% H$ s0 c% _8 x7 L6 o6 r7 X////下面不需改变////////////0 H' ?# r' T/ T" W! G! S* Y: x
/ o& K% n6 l9 {0 d0 z
var copyspeed=marqueespeed
2 o6 `7 N* ]9 _- E- n* Nvar pausespeed=(pauseit==0)? copyspeed: 0: }! m# A1 H/ q! w/ r
var iedom=document.all||document.getElementById5 j5 R+ b1 N; J7 v) O, u) w5 K
if (iedom)
) Q! V! f) G, h) Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. j, p& v! H. Svar actualwidth=''
3 V4 ^* X$ a: q2 B4 x8 S& z- [var cross_marquee, ns_marquee
1 c* _, Q: G! ?9 Q5 |' g! b' ]( c2 N8 O
function populate(){/ H: ]0 [/ k; T8 a; t
if (iedom){* m% j0 B' x- H# h& T: s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee [0 G/ O" F/ N; l; ~ C$ y; V; m
cross_marquee.style.left=marqueewidth+8
: S. ]. `! s+ ]- C" X5 M* wcross_marquee.innerHTML=marqueecontent7 \) Y* b; Q" e& K8 Y5 \1 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ u/ u6 ` d& h4 `4 G8 G}
) ^) j7 t% {: P) O6 M0 ~3 j* j: e8 yelse if (document.layers){ G( [9 K. P0 U7 Q; V3 o7 k
ns_marquee=document.ns_marquee.document.ns_marquee26 ~0 ~/ A) x7 n% s) T' S
ns_marquee.left=marqueewidth+8 p, y' D8 w& ?! M, D
ns_marquee.document.write(marqueecontent); j+ G: m; b) Q( V6 Y6 X
ns_marquee.document.close()
+ `. w$ F# G: V; {actualwidth=ns_marquee.document.width6 ~3 Q0 S0 X2 f/ c5 D( |
}* p# S+ Z; B$ m5 h% n
lefttime=setInterval("scrollmarquee()",20)
; P: b% N+ W$ t: Z}. H+ V" g' j7 y0 {, |
window.onload=populate4 ^! n. }. g* ~
* @1 _- g; ^+ h7 e* c6 m
function scrollmarquee(){4 N, O, ?: T( q$ q
if (iedom){
4 {) j: v! z0 G, w& bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# L6 w" W) M: ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 I- i" y" d) N& V( u" G9 q, C, Zelse
3 q1 f, p7 R9 \cross_marquee.style.left=marqueewidth+8! A9 ^- @& n$ _
9 r( r8 l# x0 l" a}
' n4 Y* C0 H, d6 velse if (document.layers){
5 Y0 B k6 F0 b& Fif (ns_marquee.left>(actualwidth*(-1)+8))! \/ {: s4 x7 v) X3 q) z" d
ns_marquee.left-=copyspeed
9 |) J' o) u9 H" telse9 U" @" P$ ]+ ?; [5 O4 f
ns_marquee.left=marqueewidth+8
- j* k% R% k z# l( N& D2 N/ ^}- b' I9 P7 J) b1 V
}' w3 L3 @" f. z3 {
) c2 ` k* W) W) Sif (iedom||document.layers){7 W2 R; B& Q( [- Z( W
with (document){/ H" h" q; x$ c- U; U1 M' \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' g+ C5 f2 I6 s" r$ ~9 P" yif (iedom){+ s, n5 Q- U9 m* E$ e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), ?2 x3 T0 B( H S1 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) K6 Z! u+ ]" S* }4 {$ }- X/ j" nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 ^: {4 z% |9 r$ M. r6 x1 H8 c
write('</div>')
. s5 b, _7 r/ z }5 l" h}! F. O" j" P+ V8 p
else if (document.layers){7 `* k! H5 i( s7 k4 [- H; t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), B' ]: y- t2 H4 [' K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! S) R9 J) D3 D: \9 M
write('</ilayer>')" ], k6 t, X* N8 a9 F0 b; A
}
; U! y2 s' V8 i5 o+ y; k, idocument.write('</td></table>')( W/ n0 E5 y3 ^* j# R
}9 C5 x; O- S+ k# X3 G
}) B8 V) l" B6 U- r: U
</script> |
|