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

|
网页之跑马灯文字特效
//修改宽度
* g- e; {/ Y; v6 Zvar marqueewidth=300
3 s/ C! } i! W, e/ }# _" M//高度
7 j: q4 q c8 z- [var marqueeheight=25
, [2 w* k) T5 r8 {" |8 w//速度(1-10)
$ d) t" o- J. c8 Mvar marqueespeed=3
* h2 m8 I7 \0 S2 k5 i6 E//背景颜色$ W0 ^ Z) O% N' B' K: p5 {/ x
var marqueebgcolor="#FFFFFF"
6 k' P2 c! `; D6 c. h//是否能暂停 (0=no. 1=yes)?" X, x( P- w6 @8 a" n6 l0 |( I6 @; A
var pauseit=1 s' F- D- X* q: L
; V3 T5 k' L4 A
//修改显示内容
' U4 d" @$ `4 |5 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 t: S; T! F0 R) e( V" w: q& _- l; j
0 c% x: S* j8 e! x1 v! }( ?% x( t: x l0 W# X0 f' f
////下面不需改变////////////
6 D6 Q1 D4 [* y; s/ {0 i, J5 e2 O5 t* f( w) g7 M
var copyspeed=marqueespeed- f( v; i0 t% g6 }" j
var pausespeed=(pauseit==0)? copyspeed: 0+ ~8 i- _9 F3 A
var iedom=document.all||document.getElementById4 v- Y2 C n$ o" m: s1 g s+ y4 `
if (iedom)- z5 C P& P6 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) s* @ F. R- \7 P2 R. Jvar actualwidth=''% y/ ?! V: i3 l+ W
var cross_marquee, ns_marquee
* H0 P c0 }! V1 w. V+ M( F3 U6 ]/ T/ K* i7 s5 m+ E, \
function populate(){
" L4 d; i, [$ |8 Z& \if (iedom){. q G( n+ `# |/ S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! h" i8 \, o! n3 O: `) k
cross_marquee.style.left=marqueewidth+8
8 y; E T9 _! R+ I) x" o* n! Mcross_marquee.innerHTML=marqueecontent
' j: H; h1 V; H+ D; @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) e2 p3 [% D/ T& |* E* o}- D- J% w" i: I! ?' C2 k3 }0 j
else if (document.layers){
0 B6 K8 e3 } jns_marquee=document.ns_marquee.document.ns_marquee2; D6 N- K6 l; M k' G5 a
ns_marquee.left=marqueewidth+8
6 S% r2 K H( D& C1 Sns_marquee.document.write(marqueecontent)
# q! b# V! j5 ins_marquee.document.close()4 g- ~8 C% a2 o
actualwidth=ns_marquee.document.width
# {6 ^) q' {2 a# k! v1 v% H, o+ C}7 u4 C% g f, O R/ G( \1 D8 Z
lefttime=setInterval("scrollmarquee()",20)! F8 J$ X( q: E8 t
}
, x. h, H6 D7 o6 I4 _8 m7 Qwindow.onload=populate
* y2 l% f0 X$ t1 i: b |1 ?7 K% i' r5 l3 ]" y- {; f6 I
function scrollmarquee(){( z5 e, y2 u, O' Z: O; F k( C
if (iedom){% I& D A# j1 p$ X/ h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- L: [' V4 G0 E8 ?2 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. i8 d0 l" l' K
else
/ H0 I. i) W. s0 ~ ?cross_marquee.style.left=marqueewidth+8
6 g" w9 K7 |1 J
; y. `: {. b" t6 T" k' `( V. o}2 A2 J8 f2 |9 f+ N" I! V
else if (document.layers){
2 k# E3 \' p A$ D9 @4 F7 Q/ T+ `if (ns_marquee.left>(actualwidth*(-1)+8))) N% G: C6 m% h4 A) F. Q* r
ns_marquee.left-=copyspeed
3 w* A( i' _3 J$ ?6 _0 i/ Pelse
: g0 N9 W k6 Y8 |. b+ ~; J0 Hns_marquee.left=marqueewidth+8
! k4 l8 W7 K( i0 c}# q. B( Y! J5 ^* e
}( R2 b* m' w' H* n8 a
( U, d8 Z8 A& Q( Y9 Q/ ?* t+ [2 u
if (iedom||document.layers){
s8 h! r7 t$ U, dwith (document){7 E. }, l. L* p6 G) |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' i6 {* b. j1 J$ M/ ?0 q
if (iedom){
& R0 J/ U$ c+ i8 h6 r& Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 {" b: t$ J/ Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* q% Y3 s& F& z6 h2 Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 a; @" E' F0 D b, Bwrite('</div>')
: v% o6 G$ s" J% F4 d}
! h" g: y" X b1 E) {, X& `else if (document.layers){. }7 L( M: m; z# C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ N; \' @ |+ O( i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 y0 t% a& T3 f; _% T6 I7 m
write('</ilayer>'), C! J( _; X; F8 }( W
}
) H: t1 L7 ?& Z( ~; Udocument.write('</td></table>')
( E$ ~6 J, N6 ]1 Q" E# D4 y4 a}
1 w- N3 R& M: T, K3 g1 F+ n+ q( `}
5 U$ v( |0 Z) Q! W0 X Q- ~</script> |
|