返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* s. ~7 n2 j7 m+ j" x( ?/ [var marqueewidth=300
8 A, J0 Q! {  u  U. v& O//高度
, l: ^: m# e! o# D! d! b# x9 }+ dvar marqueeheight=25( ]4 I0 o& G- A" ?0 h" a
//速度(1-10). V6 K4 g) P/ x6 K" ]/ ]" i9 U8 c
var marqueespeed=3/ S& \! ^+ i$ G* _4 |! ^9 N
//背景颜色0 Q* j) m  a- [
var marqueebgcolor="#FFFFFF"3 I1 i# U# R0 v* K6 ]7 Z7 \
//是否能暂停 (0=no. 1=yes)?
* |/ d" e+ `, Evar pauseit=1, N* k; A6 v1 V. `: F& E) _

8 E2 U* l/ n+ {% r//修改显示内容
; X3 @7 y/ c8 W3 O# p5 y8 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: V0 {* ^8 n& p4 f: b* {" I( K7 a
) \, @+ r/ w5 {% P7 v
# {  {# W# A1 c////下面不需改变////////////
$ A9 z* }+ \( L/ ]
* h! b$ X6 o1 b7 W8 `var copyspeed=marqueespeed* N7 E( w  N+ j# U3 ~! n# G
var pausespeed=(pauseit==0)? copyspeed: 0( F6 [; i- R6 D
var iedom=document.all||document.getElementById
5 v. d+ m6 a# |0 Q6 x7 l0 E6 Eif (iedom)
& @- w& L* @) U$ A" F7 V, ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' Z6 h# w% K; ]  l2 y
var actualwidth=''
# i3 c1 d1 l! C6 avar cross_marquee, ns_marquee
# l4 x  V" w8 L' }/ F# o8 X, b) `) Y& [" R4 z7 Y5 j9 B8 F9 z0 ?2 ]
function populate(){( B% c# M* R" _! j9 C
if (iedom){' i6 B4 L7 @0 o0 _$ n+ ]$ f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 D8 }. o' |4 |& hcross_marquee.style.left=marqueewidth+8( ~2 e& p$ |9 O( ?$ }; T( O, F' v
cross_marquee.innerHTML=marqueecontent
  m2 ^) H3 c& L( |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 w$ N; P9 J) Z* ]0 V
}
- x; Z9 X, \5 q6 ]else if (document.layers){4 {, v4 f8 W& D" c; s3 _
ns_marquee=document.ns_marquee.document.ns_marquee2$ z' I( z' y% R4 V# J. i" G( Z
ns_marquee.left=marqueewidth+8: d' C) \0 z( ?
ns_marquee.document.write(marqueecontent)( s7 A9 v1 t( i$ y" y8 m3 r( e
ns_marquee.document.close()1 ~% k3 N4 s# M" L1 c
actualwidth=ns_marquee.document.width
2 o+ }* P* L0 g) K  x4 \1 Q$ @8 _+ @}! V8 [. Q' V& @& t" O
lefttime=setInterval("scrollmarquee()",20)- y7 g. f: l$ B& u
}& M3 Z1 `2 d3 E9 C7 t" ^! S$ t
window.onload=populate
. _" E" C, o+ c6 X& i3 ], _8 J1 H* A! D, g2 p4 S
function scrollmarquee(){
0 E# n' r+ E5 Y& j7 t+ N3 i$ hif (iedom){; L: e8 @" Y6 l: _$ m
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( M* E# h, P+ ^# Z9 D. ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  U7 g/ L' I3 J/ }( Delse
5 w0 n% ?$ O) R. r# @cross_marquee.style.left=marqueewidth+8
# D  F6 k* S. e! {+ B. @4 ^+ J3 ]% d  a
}
" f! k6 w: K8 V! m' @else if (document.layers){
+ v/ P$ Z* t# _if (ns_marquee.left>(actualwidth*(-1)+8))$ W$ ^' p- v! A$ m3 z
ns_marquee.left-=copyspeed
! R5 G% ]: a# _8 R( i  o$ Uelse6 q1 J. m% l7 Z- y3 Z) }( Z7 T
ns_marquee.left=marqueewidth+8
: f+ E7 k1 o$ Z. m$ Z8 |}; X: u! w( l5 j9 Q
}1 G8 v+ O! C4 w! ^: U/ C
4 {. K9 t6 }! n
if (iedom||document.layers){) z5 O& _9 D8 c7 g, T" s! S
with (document){
& j- @+ F2 \& M5 ^7 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ R( ^' t$ B4 hif (iedom){
2 D: B7 \% o7 bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  [# d, u, K& o# _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ D8 d4 w. U9 P9 V# W! [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 w$ n# M$ v# v7 B$ H
write('</div>')8 P) n& ^5 j6 s' X7 n; `
}2 O$ {+ V) f0 ?3 K5 e
else if (document.layers){
& @/ r5 R& |2 m3 Q8 q4 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), R( g4 N/ z+ X% {6 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, R" D4 U- G1 [% Uwrite('</ilayer>')
% \* G9 F  O3 p; U  z# J' U* Z}
0 c" i, o# I( J  j& idocument.write('</td></table>')
) u! Z) y+ Y; j}- d) q7 R" e. i& e
}! |9 E7 I0 ~7 \$ H3 ^1 i, O
</script>

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