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

|
网页之跑马灯文字特效
//修改宽度" u6 O: y! G" D9 J9 U1 d7 u$ y, \' J, m
var marqueewidth=300" M/ U6 L( {- o, a
//高度
. T$ L3 r/ t, M: o! Lvar marqueeheight=25
`0 Z0 w6 f8 N//速度(1-10)8 W/ K1 m+ h$ m n( \
var marqueespeed=39 T l6 }' X' w1 S
//背景颜色
# x. W4 q: h) W9 n6 {" c* F# @var marqueebgcolor="#FFFFFF"
' ]# I5 ^7 o- m% @$ H; r, a7 j//是否能暂停 (0=no. 1=yes)?
: H7 T% X4 A0 a }+ g: Avar pauseit=12 w, X' O) }; X- x
& N( Q; {( V# Z, {, p. Q5 o4 C: j//修改显示内容
1 z$ Q3 u- p- ~/ i ~% a5 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') v/ b/ t1 C! @
" a$ X- h: u/ l. R
6 k, p( w# U' Z////下面不需改变////////////( w7 n, X. F& C- D' d
; u" A& B* Y% H6 g; U, d2 F
var copyspeed=marqueespeed
6 H# j1 Q7 W; cvar pausespeed=(pauseit==0)? copyspeed: 0
' i9 C l; Y8 Wvar iedom=document.all||document.getElementById
( H4 v; A/ v. N! m' s: f. T: e# Yif (iedom)
* ~+ k$ G t. g( E0 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* `/ M' P8 R4 i" Pvar actualwidth=''
$ V8 n8 Z. j, U3 r; N% J& `var cross_marquee, ns_marquee
- ~2 |: x8 I$ ^) w9 h2 b5 l2 B: Q% [+ K4 M
function populate(){+ \, r$ v2 _& S) d( p- Y2 `
if (iedom){& w# y% `2 A: ?7 k
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, B+ B- W* t" u, B$ e, j" L& Lcross_marquee.style.left=marqueewidth+8
6 ^9 H( @- |: X5 v) K! ~cross_marquee.innerHTML=marqueecontent# z( V1 P( M) W5 O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 |2 u: T$ f; s! c* B/ K' X
}* d4 |& W5 Q. q
else if (document.layers){
v# o* k* }+ zns_marquee=document.ns_marquee.document.ns_marquee2
, ?# `% ^' M( ^- q6 F+ c$ Hns_marquee.left=marqueewidth+82 f5 e0 l$ a# B5 l) d
ns_marquee.document.write(marqueecontent)
`7 n) L( w7 U0 s8 y) mns_marquee.document.close()% n& D' u9 n2 R; g
actualwidth=ns_marquee.document.width; i. n" }0 O! L7 T) ` p
}
! t0 S# }% X1 e/ y+ Flefttime=setInterval("scrollmarquee()",20)
; U) Z0 `4 A% `}
# Y( b9 H: w& U! i1 @* y _window.onload=populate
( b) d5 `# L6 M' [, C! [$ _% v( i# K, _7 n8 o
function scrollmarquee(){/ j, X! t$ F6 }
if (iedom){/ e& k( F& ?; S0 r; Z3 O- Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# R/ V) [6 B9 R) r, O: |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! e, m9 V9 q4 Z3 V3 v! @else; t9 X2 s0 F! m: q5 `5 ]# j; {; U
cross_marquee.style.left=marqueewidth+8* S6 K! y1 D, @
( S- [; j6 q+ I
}; p1 u) {, |2 |/ G+ {
else if (document.layers){4 M, X/ l" E6 n; {% {$ s
if (ns_marquee.left>(actualwidth*(-1)+8))
5 V1 ~ a% j* S& A2 d2 vns_marquee.left-=copyspeed
4 B0 Y; e; g0 U3 W4 gelse+ T$ t9 F! S& s1 V' h+ L" d8 G
ns_marquee.left=marqueewidth+8
# G. E( U, u# i5 n/ J' z}
8 B8 k+ N j) ^+ I} X$ p( |) ~4 o% F. d4 i& L
# l4 z' _7 ?: ]" X7 B+ n: Q0 Q. S
if (iedom||document.layers){
8 T) |' [3 w% Qwith (document){
1 m9 u0 k7 v7 Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! K3 @" K- b2 m. T- `+ m1 }: aif (iedom){
8 I! C& `9 J/ b3 @ j( H' ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 o, L' y9 _3 T) M8 K4 c$ f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" ~2 P( Z9 x2 V! Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( J! i, Y6 d; ^6 c6 t: t4 Q4 k) b8 m
write('</div>')
7 C3 y, ]" X# ?}) h$ v# I3 n/ q3 e5 v
else if (document.layers){
" K4 ]& {2 \) @3 xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; U8 N& d1 l# n( {/ c4 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 y3 @" O3 G8 p7 q% y2 W3 ~2 jwrite('</ilayer>')3 l& S% G. G) T$ F% U$ ]6 t0 y
}
, ` L# h( _) R- W5 B0 pdocument.write('</td></table>')
, N ~: R4 b* k% ]% l}
% P2 p+ V& H2 t3 D; ~+ L, u% N) T}
2 U/ {- [. N, M</script> |
|