返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ p! I6 z# R& p- y. E" Z
var marqueewidth=300! w; }/ Y, ]% K( e: @
//高度
* W2 C2 z: d0 G8 e, mvar marqueeheight=25
9 [3 ~% \- c' j# ^: T//速度(1-10)
- P5 Y# P3 h6 T0 F3 `. fvar marqueespeed=3+ W% [4 T6 J  S( b: v- y
//背景颜色
0 ]6 D! M& I9 H" G  k, qvar marqueebgcolor="#FFFFFF"
' x; l$ p" b' @2 i//是否能暂停 (0=no. 1=yes)?
: t- w4 k8 b0 S: d, Z. @9 d7 a4 Cvar pauseit=1( `7 Z! U1 a' c) F
1 A; b6 [, o+ R; |/ B& O3 Z# l+ ]
//修改显示内容8 Z* f* H; }3 O/ X. m4 I( D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 |! r$ ^: z  M2 C1 O/ A& q- S5 F7 R- {
0 s( v3 x8 c2 \6 A
////下面不需改变////////////
9 }' `& E& ]; Y' w+ _' u; x
$ ]: t+ U0 n2 e% cvar copyspeed=marqueespeed
2 h: S4 ?( s( |+ ]var pausespeed=(pauseit==0)? copyspeed: 05 O0 J  Q! _9 e7 [4 M8 V  v
var iedom=document.all||document.getElementById
& N2 |$ O) w8 p7 Nif (iedom)& \' ~1 `$ v/ }0 {. n  z/ J5 U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' C" u) D  a0 j3 n
var actualwidth=''
6 r9 @0 R+ _% s+ _  L, O4 xvar cross_marquee, ns_marquee3 H$ n- i( {5 j+ h$ z  m

5 W: ]8 \# [4 Y. l6 lfunction populate(){8 B* j. p$ X* f& L# Q
if (iedom){% x- ~; t$ X8 x4 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 m. W8 N: ~' S' d$ G
cross_marquee.style.left=marqueewidth+82 ~) C0 x. x, X' `7 V# J, E# g# y
cross_marquee.innerHTML=marqueecontent- @: _/ Z; I+ W8 h+ d9 n# ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* |8 x- C4 ~0 |. x6 K
}
& e8 v; Y$ N9 yelse if (document.layers){
3 G: O2 M: D0 \! wns_marquee=document.ns_marquee.document.ns_marquee2
# x) c" A. ]! d/ H1 B5 xns_marquee.left=marqueewidth+8
8 d0 d+ o  z' q2 n4 }ns_marquee.document.write(marqueecontent)
. h. j3 _, b, D1 ]4 Xns_marquee.document.close()
: P( B& H0 j8 j" h+ x% qactualwidth=ns_marquee.document.width3 k7 u, |8 [; V9 v0 a( r
}) a1 T. \5 Q2 m. w- H+ c. y
lefttime=setInterval("scrollmarquee()",20), ~! Q( \! V- w! v/ H9 z
}
+ q' z4 l( g+ E: g' @: f/ w; o0 Nwindow.onload=populate1 Y( {3 x! ^0 P) R  _% P3 u( q
& t5 o3 \3 G' i& M
function scrollmarquee(){6 [$ \1 u" g& r5 P1 p  b3 F
if (iedom){/ k8 x) R2 w% M# F( q; m% J  C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% f1 A9 c6 F/ _& s9 N5 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" s8 p5 q0 \% Q2 A, {  ]3 ~
else* ^3 Z* X/ n" c, b7 k9 U5 R+ v
cross_marquee.style.left=marqueewidth+8
# D; K/ b8 o  T) Z0 d) K. D+ c9 v  i; T7 t
}
9 a, s( f6 [; r% C2 |7 velse if (document.layers){
1 b* }. @7 I4 U8 \5 fif (ns_marquee.left>(actualwidth*(-1)+8))
7 E0 R+ m  Y# }ns_marquee.left-=copyspeed
( a2 f5 {! ^: U" S' B9 velse
% v3 f5 I7 }+ B& {! pns_marquee.left=marqueewidth+8
/ v8 _4 w$ _1 ^; g- y}
6 h% i* F5 [+ b2 G}
9 J6 g! L! ?0 ^7 g) b6 a$ ~. s1 a% O! {. C
if (iedom||document.layers){
7 [" y& F# \1 n# h- C& kwith (document){
4 F6 ^/ K+ \7 ^( adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' ]& P- X( J5 R8 k! d
if (iedom){
% d. t7 T* @0 K5 J5 N; fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 F; d' e2 h, P: T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) s. ]) v2 i- G* ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): s" [! o' a6 ]$ z
write('</div>')+ K# t. e8 o, i4 S7 C7 p
}4 z2 r- b. }# x' B, P
else if (document.layers){# K% I4 {# w: Y% K! S! S4 c2 u+ u: n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& k! [8 Y% M$ h6 n$ E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 f$ C+ m9 K7 D7 W& H: A
write('</ilayer>')* V$ E5 T) E  r) j7 l/ `8 b
}
1 o  D* q" r1 s+ _! u. F3 L7 w5 G8 Wdocument.write('</td></table>')
- u2 j7 c5 H: _! n7 Z7 |1 f1 a}
2 U0 l2 b& d* E1 Q# u7 y}* l, r- a; k) v) B1 J
</script>

返回列表
【捌玖网络】已经运行: