返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: @3 x/ E& X! Y- a" X, \; s7 Evar marqueewidth=300
2 e, a* G; f  E6 w  f//高度
* A# m' S8 U- w1 X8 _var marqueeheight=25
7 g. _+ q4 u! ~% T! s//速度(1-10)
9 P, Y9 J8 k% K, Lvar marqueespeed=3
1 p+ ]4 f' ^+ A* @//背景颜色
/ l- @& T. f" B# U; Mvar marqueebgcolor="#FFFFFF"
# |) h4 n7 N1 n# @# \( S//是否能暂停 (0=no. 1=yes)?4 j2 H9 s1 l. K5 o
var pauseit=1
' u: x/ H" {: j- ^% ]* u/ ^
( `7 K& y5 {$ n5 e9 y//修改显示内容$ m; X; q0 U' V" Q" c; S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: T! P. k& J* `9 F  u9 J) V7 Y) ]2 |  `! `

) K2 E, ~, E( }. x4 U- H////下面不需改变////////////
. e6 Y/ U8 m  D; @# c  w% h. v0 Z; s1 g4 I! @
var copyspeed=marqueespeed
0 |) ?% `8 _! V$ C! y4 jvar pausespeed=(pauseit==0)? copyspeed: 08 _# }* x0 k& K9 _
var iedom=document.all||document.getElementById
3 f% H4 \0 M' D: h4 X# _- d) Uif (iedom)
% d3 e8 b% {: g5 O7 I7 G0 E( T' r% qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* P2 [0 \' K+ I' k" s" a8 Rvar actualwidth=''
( U* F5 X( q# ^, zvar cross_marquee, ns_marquee
) K7 }" A# O8 [, l1 e9 j4 Z* D/ ~9 u: d
function populate(){
5 d& }1 B, P/ i! a' F  uif (iedom){3 m; D- B- w9 E/ V  O$ _+ M5 W9 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ \7 {# u" A- H, W. D' P8 ~
cross_marquee.style.left=marqueewidth+81 H0 J+ B  [/ W" Z7 y; F$ @4 a
cross_marquee.innerHTML=marqueecontent
2 @' q# S/ R  nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' w4 ^8 _7 o% j}' v* o1 @: w" a2 R: }$ a5 Z
else if (document.layers){
5 u3 }4 a* d5 e4 ^# g/ ans_marquee=document.ns_marquee.document.ns_marquee2
/ k/ s: ]4 ^+ m1 m, o& p  ~0 ]ns_marquee.left=marqueewidth+8! A  ^$ R6 s( u0 ^: T
ns_marquee.document.write(marqueecontent)
& p+ M% N& p3 @ns_marquee.document.close()
0 R  f( \7 t( [8 V8 ractualwidth=ns_marquee.document.width) }/ t( u9 y3 J& C( R
}+ e6 I! {: W3 X
lefttime=setInterval("scrollmarquee()",20)
/ d* U5 E7 K8 k5 r% F6 `* I}
% Y& F1 z$ b7 ~6 owindow.onload=populate
& L/ l6 I+ m" C& h% q, M- K
6 d* t; Y/ t# F3 y3 Xfunction scrollmarquee(){( Q& o  L) A- @$ b( U* M
if (iedom){
+ G2 @9 A5 C1 ]$ m8 w4 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" k! c; ~9 R0 O1 X9 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  u& B# r" W5 [7 Z! K8 a
else
1 i6 J) t1 i2 G1 ?) L) i; _, r- Qcross_marquee.style.left=marqueewidth+80 z, L& a! G2 |/ v1 l# k1 u
( t  R9 ~8 T' z  D- s
}- H; I, p! ?! d7 G
else if (document.layers){& v$ v$ y% M( q/ t$ L; d$ G
if (ns_marquee.left>(actualwidth*(-1)+8))
" o: H' b. r. s) k5 U# [ns_marquee.left-=copyspeed1 ]3 x2 c% K% l' p
else
8 G' ?/ G# t; l2 J6 l: j; \ns_marquee.left=marqueewidth+8
& r$ N  k8 m9 A% G9 j; X% D}# W$ f( R* ~# S8 t1 }. n/ ]
}
) W2 z3 `; f( b- T% ^2 v% k) Q6 w, q# t
if (iedom||document.layers){6 f- E1 p# ]% S" f3 `# f) z
with (document){
( U  Y6 Y/ Z9 l1 {9 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) Z3 K: e1 r# |# C( v: N! Qif (iedom){: L' W: j- P0 ~3 N7 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# C$ J& `' {7 \% G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ s9 s& t4 t) ?( C6 }+ jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 \: u- b/ K5 b) ]; ]( B5 t/ l$ _
write('</div>')2 W+ P. R+ i( |2 M2 @& Q2 ]
}" n2 C  I& ^3 P6 }* h3 D
else if (document.layers){
' ~" q; X9 k, P$ M0 [& Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) T& i' I3 \7 i! x. {/ Q7 J& x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& z" g" d2 j1 Y. P
write('</ilayer>')- S5 D- u+ j9 G2 K
}# s+ a% l) N3 S' n( }& Q  |* K
document.write('</td></table>')
- [3 i( x* Q0 H. c}5 i5 J6 C6 i$ I( e
}5 n7 `9 f' [* {. d
</script>

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