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

|
网页之跑马灯文字特效
//修改宽度
* p- U0 P- z; r7 X9 \0 Ovar marqueewidth=300
( l1 t% N5 e) F& A& y- B* G2 K. m# a//高度; x" U# l ]% ?& ~
var marqueeheight=250 P) S4 }& s1 f. Q5 E5 u( w+ A
//速度(1-10)
1 w8 z" o2 S1 gvar marqueespeed=3
5 ?, b4 K& r9 T+ ]7 D% ~3 o//背景颜色5 g8 |5 c; A1 m
var marqueebgcolor="#FFFFFF"# c8 F( H- H# m5 j$ X; K
//是否能暂停 (0=no. 1=yes)?
% O% }3 V) w" z0 F; Avar pauseit=17 G% C- ?0 t. o2 j% E8 Q
$ \# [" @! U1 ?2 F//修改显示内容
p% B- p$ `9 Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 t* d4 R4 ~5 p- w* t0 |* p$ J. B8 k: c$ s! B
& `8 V1 h% P: Y8 v, X$ R////下面不需改变////////////
! a; A% D( o' J- N3 H' L1 Z5 y/ ~3 @ Z, ?8 L4 w( e. w
var copyspeed=marqueespeed
& p$ ^1 @% U! O1 W" Lvar pausespeed=(pauseit==0)? copyspeed: 0* Q9 s1 k" D0 y! U) i
var iedom=document.all||document.getElementById
' D0 v) i% E8 @: Y4 D; Tif (iedom)
9 m+ t; r) v! vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 l! Z7 z8 X1 `0 p& k5 ?
var actualwidth=''; @* |" A/ i8 O' ^9 p
var cross_marquee, ns_marquee! s0 h5 P' k# M+ _, d
: I* ~- A# x m% x
function populate(){5 t) U3 J& q8 ?7 E
if (iedom){
9 Z) b& |5 } [# F. J( v, icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 l$ M% y' Y! j- j; j
cross_marquee.style.left=marqueewidth+8
7 h; ~: O% d* ]" t1 N5 b: V/ B, Rcross_marquee.innerHTML=marqueecontent, G9 ^* ]% R( i& H0 X% c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# o! l+ f# J# R6 ?}& ~1 p/ t: m$ u$ m, G
else if (document.layers){, y% H: P O: L9 h; F% N
ns_marquee=document.ns_marquee.document.ns_marquee2
+ {7 g9 m: S, A0 ]ns_marquee.left=marqueewidth+8
+ C3 e( ~- m0 j* hns_marquee.document.write(marqueecontent): {1 B( s5 R) H3 |* w
ns_marquee.document.close()
6 w/ }* w* J# f) h# n& I ]actualwidth=ns_marquee.document.width
0 y! A8 _) v/ c( d1 W- M}0 P0 t( d4 }5 r' ?
lefttime=setInterval("scrollmarquee()",20)
, m2 p5 j3 ?0 O8 D J6 x2 l}
/ [! p. L6 y! T5 nwindow.onload=populate# z7 T/ @5 q, M2 T" y; T Y
* r" H; I _" w
function scrollmarquee(){
& j& q. O+ `9 x9 T# s6 T' |if (iedom){
0 K; V8 _- ^ fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 m9 j- H& S2 o" h" Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- X+ k) ^( ?. b4 p4 J7 l
else
% Y: H, }3 Q2 D3 C( ncross_marquee.style.left=marqueewidth+85 b0 p% Z" ~ E3 |; I
6 d0 c" n. k' O* w5 H}
5 F+ s0 `1 ?% Y+ z9 zelse if (document.layers){
% i6 ^8 F' S7 }# }# ]* |2 jif (ns_marquee.left>(actualwidth*(-1)+8))3 N& u% C( I0 \5 g; \ U
ns_marquee.left-=copyspeed
( q# `0 O- x3 ]8 \! I0 Gelse
# y+ ~: [" J4 o$ c. a8 @ns_marquee.left=marqueewidth+8
: W& [/ m9 `( S% I8 c}
! P5 i! B/ B4 W3 v& ]}
. {; `! s5 v# {
1 u4 t8 y" ^1 S; e# `if (iedom||document.layers){. x" I, D/ R4 U' e/ g7 Z
with (document){* u4 z; a: K- t1 r" R b9 @7 K6 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 _. I+ J# w; K/ f4 j+ F
if (iedom){) l6 H& x2 f! k% ~( I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% \1 C. f. c6 g4 P6 n# ?" F2 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' S) s q: h" _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 a }( e* G8 Y1 E) x8 `
write('</div>')( U7 o/ Q/ k$ W8 u* b
}+ b2 J& }1 ?- e$ H
else if (document.layers){
; `) @( M/ e- T' r+ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 S, y6 i6 |+ _2 g7 x! r: C& U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ H) Z7 O& ]; u+ [ Y, r$ e4 `
write('</ilayer>')4 K1 c7 k0 ~# s& Q# [) J
}
* X& t Q/ `2 ~, V7 Bdocument.write('</td></table>')! J3 \% }9 [/ P# \5 C+ z/ Y2 i9 g
}' I0 V: o3 Y1 l' j' R2 L* l Y7 ?
}2 l* k1 v, j3 m, O
</script> |
|