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

|
网页之跑马灯文字特效
//修改宽度
' @% C9 [+ Q" kvar marqueewidth=300
! [& U# O1 d0 C3 ?8 m0 V5 |% _/ v//高度9 ~' U* _8 B7 |% A2 d% v6 V
var marqueeheight=25
/ o6 h. l) |- q3 y//速度(1-10)
1 E2 A3 R/ v1 w! n2 v* e3 q3 U( Kvar marqueespeed=3! U* C# c" H8 i+ R3 Q% }. M- f
//背景颜色$ c! ?( D6 [9 d+ W
var marqueebgcolor="#FFFFFF"1 x, b; I/ u; P* l/ Q
//是否能暂停 (0=no. 1=yes)?& \5 N/ n& {7 P7 f
var pauseit=1
. M! P2 a) O. K4 d
4 P5 F" }1 E6 L; P6 O5 J//修改显示内容
9 E" b- X6 h( K/ u9 P3 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; L/ |# O B$ Y4 X2 ? y) M- r1 y! E2 a
' b* w# {* B) H////下面不需改变////////////
5 k% v, t3 b. |" y1 J3 [# u# c; W( [# [3 o3 U. R! z
var copyspeed=marqueespeed/ G6 I' c! o( p7 j& u
var pausespeed=(pauseit==0)? copyspeed: 0
/ ]( f. y/ o( k8 d% p9 m4 |! x# m* vvar iedom=document.all||document.getElementById/ ]0 c) d0 E0 S- q1 n) R
if (iedom)
, P. H2 [6 q8 } Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- F$ E; m+ J- `, d" f% n
var actualwidth=''
- u& ?0 F3 u5 q9 `5 dvar cross_marquee, ns_marquee- r# U! {$ N! H+ [2 \
9 V" g" T7 L b) L0 O! y
function populate(){: p0 g+ e2 d7 n/ W* x
if (iedom){4 f$ i0 w5 f5 L ~6 I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 b8 k0 Y t% t/ _5 n5 k9 `3 }
cross_marquee.style.left=marqueewidth+8/ w0 H8 T5 E; A7 H5 p
cross_marquee.innerHTML=marqueecontent
* Y' ?1 b2 x- X) Q' Z mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: e6 P' ?% O* g6 @: J
}
, u0 D3 k, u; c% X* n# A9 T4 melse if (document.layers){0 U" I: }, u- W5 m6 a. S" h1 Y
ns_marquee=document.ns_marquee.document.ns_marquee2" K8 R- m% [( `: O
ns_marquee.left=marqueewidth+88 D. z: S% ?( b& K
ns_marquee.document.write(marqueecontent)0 i2 U' b( ~% B- \! G, ]1 d
ns_marquee.document.close()
4 G2 X( p5 n8 [3 u" Wactualwidth=ns_marquee.document.width8 G" r( g7 b( k, ^& N5 z' ]
}2 K: N' c; E1 [/ w$ o
lefttime=setInterval("scrollmarquee()",20)1 C0 G. W) a6 Y+ D
}1 A! o) r3 w2 i( l7 {
window.onload=populate
. q) P4 x% `2 J2 f8 u) O( ^, P$ O" x: m& }) w% L
function scrollmarquee(){
9 i3 L, ?! M) H- w5 o- Y& y$ Z! _+ M7 uif (iedom){
% S# t) z4 V# y2 t3 S, Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ B; B8 e. z1 N6 B( J% i( R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" c1 C, A) B; gelse
) ]2 v9 s; e. r& h! `cross_marquee.style.left=marqueewidth+8
% I2 u# O W# N* N: _7 S: B: B5 s' M' a D l* P
}# }+ a4 n& t+ r2 }/ N6 E
else if (document.layers){9 Z0 O$ c: O# I7 q7 x2 ^! a( C5 y
if (ns_marquee.left>(actualwidth*(-1)+8))
/ X$ ~( }) @* h6 Ens_marquee.left-=copyspeed
* \9 S# X @$ y* c$ L& selse
. s+ S c. ?0 G3 g# \- i8 |3 @ns_marquee.left=marqueewidth+87 x/ |8 `: _1 [: @
}2 ~( N0 \/ T$ A2 I7 N2 B
}
7 u6 n/ S$ \! `2 E
+ G8 o; l( _/ B4 aif (iedom||document.layers){ A$ y" G! L# m/ D" \1 A
with (document){! X: V1 p9 |+ }% \' O/ N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 L! a' y7 r" Wif (iedom){5 E; R0 X! s0 k8 C: @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, D6 R- S H; ^ U4 ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 }( Z, |: x b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); G V E# O+ W2 Y
write('</div>')
5 \* V& O! J& a) Y) A& S}- f5 Z, ^1 U& ~4 I) W
else if (document.layers){7 B% S. y- p: e9 U" L" U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 S! W7 r1 @% \9 e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. j8 h0 U2 m. s4 p7 lwrite('</ilayer>')
~/ q1 e0 a( n% R1 z3 w. r}
6 k- j3 h* P" s# Ndocument.write('</td></table>')
( Q4 M! e' Z6 n) ^% x}
, e. U. V$ G, I# j, n; `}
; n( x7 h5 ^- V: } j& o</script> |
|