返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 I8 j$ ~2 }, j8 [9 ?' D- Avar marqueewidth=300
0 d( o, L6 N7 V6 b7 u9 ~0 ]//高度- ^1 {( O' D" O' A
var marqueeheight=25
# }4 G$ x6 b4 v8 q/ i7 j; s//速度(1-10)
& T( P* \4 [- rvar marqueespeed=3* z9 H% y( [' Y7 s
//背景颜色! b: v1 o4 J9 ^3 \( E! v' a$ h
var marqueebgcolor="#FFFFFF". Z1 {. m$ l% r
//是否能暂停 (0=no. 1=yes)?
$ z( e1 o- b4 W; Mvar pauseit=1
9 R$ e( m! r# C# @( \1 }
5 q2 o, M" \9 E" u( [, O//修改显示内容1 V! A& \" A' [1 A& k; E# @: l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% g4 G1 E! P( H% {: g* |# a

, N9 A7 `. O& U  B# k. A
6 c& \" ]/ y& f////下面不需改变////////////) `8 T& D( f4 b* K
& S/ t* U3 z* z
var copyspeed=marqueespeed
; j1 y3 g8 G) K, Fvar pausespeed=(pauseit==0)? copyspeed: 0& @# {/ J* p% ]- J/ o. S+ G
var iedom=document.all||document.getElementById
  G( g1 C% X  _3 i0 i+ P! ]if (iedom)
* O" \% ~0 \( t2 h8 t% p5 udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( x+ e7 K' f1 w5 ~. J- I. s4 o1 K+ Vvar actualwidth='') Z9 `- a  U$ J+ V, l( k
var cross_marquee, ns_marquee
3 r' l7 i% Q% Z: m
1 W' r. t" m' U2 I* ^function populate(){
2 x; ~7 L4 b9 ~2 uif (iedom){. O8 ]% O* T' T* [% A! m. x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 f) u" b( T, ?' i+ u  p8 e% J6 t
cross_marquee.style.left=marqueewidth+8- ?+ c: o' u5 ~- Y& Y2 S
cross_marquee.innerHTML=marqueecontent- V/ O& [8 W7 y$ V- P, O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  ?3 j# l' D' J
}
5 a' v1 K- g2 oelse if (document.layers){" S5 y7 a) ~2 ]0 C! b6 W
ns_marquee=document.ns_marquee.document.ns_marquee2
8 V) p% `0 n& x4 ]! \% t3 c! j/ t6 ins_marquee.left=marqueewidth+8
# H% L& v2 ^- U0 D$ ?# ^ns_marquee.document.write(marqueecontent)/ i# n! p/ ]4 ^/ W
ns_marquee.document.close()
  f$ U% `' V2 r& I  e( k( W2 Eactualwidth=ns_marquee.document.width
7 ]9 j* K3 L% J}  [" H7 Z; \& o" E1 E/ h
lefttime=setInterval("scrollmarquee()",20)
' q2 P& n+ \8 S1 k: t6 D# e' @5 @}8 t% G* q+ T* X9 h6 Y
window.onload=populate; n+ O( j& S& L$ O2 d, Y$ {

% G& `% I. f% }/ p0 jfunction scrollmarquee(){- ?5 j5 \) i5 R* ~/ U
if (iedom){% U9 b! q( k  ^' F; {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( g# J4 D$ u5 j0 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) u( A! Y8 V8 i* M' Z# f& k
else1 \! B- L' m0 K( x8 y9 @1 b" O3 K8 a
cross_marquee.style.left=marqueewidth+8" R# d$ R5 g# O( r  d4 n0 i
/ `5 G: j* {: u
}6 w/ c+ h% }% l, I3 G0 f
else if (document.layers){1 U. h: A# X5 j* b# x6 J9 K! \
if (ns_marquee.left>(actualwidth*(-1)+8))  e% z/ [1 T. `, D) L
ns_marquee.left-=copyspeed
# o& K9 h* L8 K% W7 R: _  ~, helse
. H& ]) G6 [" U" u& z$ d- a* Ins_marquee.left=marqueewidth+8
+ P. n+ }1 ]% B( u$ Y}' m; J" |. v. @2 d; g" J
}* e, Y' Q, Z( @8 U
2 V: N+ W: D# c4 F+ {. \# y* _& g8 N
if (iedom||document.layers){
7 ?' K5 C, Y% h* E- Lwith (document){
3 v- [' F! G3 ^" b  M: t$ Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( I- M% x, G6 e! Jif (iedom){2 ^; U7 x4 T: R; K% C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% o" {* q/ }: uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ J0 m( a% ?( e$ b% A9 q3 O; g; Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* R! z+ G# m8 Q% Ywrite('</div>')
  O% Q; V' d8 K+ X2 ^5 o: {* m( w}7 ~* q: p/ Y/ c5 W  p$ y
else if (document.layers){! ]! h8 m( p) X( _6 o  P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) Q0 _4 D: X) Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. H9 F4 f* |* o! xwrite('</ilayer>')( }/ Q4 A5 g" W( r: r( J; Y0 {3 _
}
, B. O$ o+ x! P9 W* u( s6 udocument.write('</td></table>')
# }/ _/ O) F$ G}
0 Z" y- q; m6 J# F}
& X3 L1 N! O! k! o. ^: H  T</script>

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