返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% E/ u% H0 {6 X/ C8 B/ J, I! _var marqueewidth=300
, Y0 O# Y: G! o/ l, n//高度
0 }- w  Z5 A8 gvar marqueeheight=257 b: ~8 J! }% I
//速度(1-10)
( B1 u. X# o5 ^2 \var marqueespeed=33 P: N; H8 T" m
//背景颜色
& R2 s. w, ~8 y+ Nvar marqueebgcolor="#FFFFFF"! z6 w. E% z% R, v
//是否能暂停 (0=no. 1=yes)?
$ r5 j7 k; k: A! ~; qvar pauseit=1
6 E& a1 b. ~  l$ z0 E) Q( h( t5 X% M. w% F
//修改显示内容7 W8 U. P, Z1 Z+ P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" h% L& I; v/ W5 s4 L6 r+ p( |
; T. Z9 B$ w: e- E0 b* a
* Z9 ?9 d& A; Y/ a
////下面不需改变////////////
1 v! Y5 d& k, O' G' @+ _- U
* z* C* o( O$ Z. _- h$ i# kvar copyspeed=marqueespeed: j& Q3 E0 G% ~1 r$ D  Q2 r8 z) N
var pausespeed=(pauseit==0)? copyspeed: 0
3 R7 A3 J, g0 a* ~1 T; svar iedom=document.all||document.getElementById
& }$ _6 |% n7 |+ f/ _+ x3 A2 U0 Bif (iedom)
) q- |8 ~; C) k+ O! U! S# cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ B- R% e# w# h" M* Svar actualwidth=''; @' ?; c. X0 H, ?' z" G# O
var cross_marquee, ns_marquee
. ^/ E) o, E& E4 m8 \7 m+ \
! U+ s% ~0 f4 Z  |function populate(){
9 ^: T- i$ G* b! R" i7 N! `if (iedom){0 v/ v7 `6 Z8 r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 E5 k) o3 ~  V# K- zcross_marquee.style.left=marqueewidth+8+ L: {% b6 _7 [; R
cross_marquee.innerHTML=marqueecontent
+ j7 A8 D  x3 |( [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, y9 ?5 Q+ _7 J& ?
}
7 ]4 K1 m8 U, q7 _  Z( Felse if (document.layers){- B& O' O3 c9 N! e
ns_marquee=document.ns_marquee.document.ns_marquee2! Q8 w, ^) `; W; Y; H
ns_marquee.left=marqueewidth+8
% y1 `+ v4 v9 [5 \  w( x+ b3 j1 H( d9 ^ns_marquee.document.write(marqueecontent)
: X0 o) U3 v& ~# {9 dns_marquee.document.close()
2 O: F1 ~1 E9 Q& ~1 jactualwidth=ns_marquee.document.width
/ U" ?. q7 Q  p6 C4 [% I+ f- ?}
* u) P$ Y. i# d. plefttime=setInterval("scrollmarquee()",20)
7 {  Y; q) E( ]}
# l5 y; p: a" z2 f; c4 |- jwindow.onload=populate& _/ X7 T8 a$ S' l/ I
0 k# ?# W3 R8 d* e' @1 K2 k
function scrollmarquee(){/ m  H+ N2 L2 k, D* A% D3 l
if (iedom){
- C2 `% }* A$ gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' C- D) T+ k- N2 q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 E. J! ^" o# e5 Q
else( ~4 H8 W' Q: \/ q  Q
cross_marquee.style.left=marqueewidth+8$ |# W) ~' b% l5 |, G  ~- h' D

  ~& u- R8 ?# ~+ I}2 t0 a/ X- u9 T$ V  i' `
else if (document.layers){5 o& C, n/ K( r; n9 a- p  @, D) W$ W
if (ns_marquee.left>(actualwidth*(-1)+8))
4 o% Q+ }& w- hns_marquee.left-=copyspeed2 }1 u! E. _, Z) f5 k9 W) I
else4 Z9 Q! p% t- k. o) }% }5 U
ns_marquee.left=marqueewidth+8/ Z% z  i1 p0 d, Q5 |& q
}1 b  ~0 D6 `; B. p0 F1 k- [2 I2 `# B
}
" [- H) l) \; M* V' v- Q3 d* ^+ W$ Q% t* J/ Z
if (iedom||document.layers){
4 @2 N1 A& F! K8 }# ?  Vwith (document){
+ w  @2 y7 m2 h; |. {; m) Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 I0 Q! E4 Y) S+ d
if (iedom){# p- A6 K5 h1 ~& b% Z; k$ T( c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* Z% L- ^, u2 o3 }2 }2 nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# N% A% Q+ X! P( \6 Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: e6 S' v% ^: Lwrite('</div>')
  R5 M0 y3 K$ g* [9 D}9 F4 n3 l; Z4 H: ]6 l: Q
else if (document.layers){
: n1 ~: B7 f3 X3 |( d; A( V! V8 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 C+ b! g  D0 o7 F, O4 e0 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 X$ P5 M; Q0 O, ~write('</ilayer>')  {+ G' J+ }6 E  G/ S6 t/ s
}
5 q( A1 u- M3 ?document.write('</td></table>')3 I3 G! w( e3 `# C, W8 R
}
7 `' A& p( s2 _% U/ K2 R- \}3 x2 r0 z: }0 s" Q( R
</script>

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