返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 b- o4 k& Q6 b) T) w. Ivar marqueewidth=300
7 Y! M( t6 f7 k//高度: z0 F: {& C1 B% H' V  b( S. U3 `
var marqueeheight=25
1 v3 G: I! D0 Q: K3 r& X' b//速度(1-10)
7 E. f* n! q4 [' Kvar marqueespeed=3
$ C, w% P- M" R6 e//背景颜色) a/ Z  K9 K3 j
var marqueebgcolor="#FFFFFF"
- h0 I: K4 s. H/ u* B$ N0 Y//是否能暂停 (0=no. 1=yes)?
" p1 A9 u' Z6 z+ ]* ]5 A5 y, Tvar pauseit=1) e$ i  \, Z; U# `( i( `+ i' T

& S" h& G5 ]+ R% V" w//修改显示内容
; Q: O3 O) \' N. P& Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% ?0 f9 J6 j( Y
$ t4 g2 j  D' m. j
) l* Q/ y; o+ X1 E0 A////下面不需改变///////////// Q( \- c+ g# r" a0 o
* ~8 K) ~: P5 i4 u$ `8 H/ p
var copyspeed=marqueespeed
& r3 Z% ~  S; Wvar pausespeed=(pauseit==0)? copyspeed: 0
$ P( Q  l2 u) v. p, Pvar iedom=document.all||document.getElementById
; l5 j# p: ~9 d/ [if (iedom)
5 z0 y) L' L- c" o1 M) Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* u: {  ~; {6 e& D/ Xvar actualwidth=''
9 M7 x" b% O+ Cvar cross_marquee, ns_marquee
2 |9 C9 F7 a% K) K4 q' {/ }, }) D( q% r' L. e
function populate(){
  @; E. B. O3 Z' v  Cif (iedom){8 H3 i% G; [+ }- B; o# X% H# _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ z5 n& U' n2 Y. A% d+ ^cross_marquee.style.left=marqueewidth+80 k: I8 U! w. I+ O
cross_marquee.innerHTML=marqueecontent
9 O6 u5 y2 T6 j8 U" K4 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  J2 ?1 m3 Z; x; G+ g5 A}
* K5 Y! ~# F) p& V6 relse if (document.layers){
: T* `$ ?* @+ r: i4 z8 zns_marquee=document.ns_marquee.document.ns_marquee2
  ?  |: k$ l3 z2 ons_marquee.left=marqueewidth+8
& ]  o/ C( p5 c( S2 xns_marquee.document.write(marqueecontent)& Y2 V4 D/ K4 }/ |
ns_marquee.document.close(); ?3 `  m$ k% ^' e1 n, \
actualwidth=ns_marquee.document.width2 ^) z; t5 ^" `" U  j
}
1 K' [4 i! [8 @* x, c/ x5 H+ blefttime=setInterval("scrollmarquee()",20)) a5 [+ c5 k  g4 w
}1 N5 f; U' V  \( p0 W
window.onload=populate7 u$ Z) i* f. g' w

" K  t: A! f$ Ofunction scrollmarquee(){  S* H4 w5 w1 t, @
if (iedom){8 ]4 q0 W4 [1 l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' C2 K8 k! f% N3 {# r' m4 l  p) Z. e- wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( C! e  _& u5 o$ helse
1 y5 F* f. |+ @$ u1 m) Across_marquee.style.left=marqueewidth+8
/ q) z- E; k! |
( q' a, {/ h: J: k- F4 L. a2 [}- C, p8 L/ i7 F2 s! ^
else if (document.layers){& ?/ ^# E& p5 O1 E: {) h% I) X
if (ns_marquee.left>(actualwidth*(-1)+8))
4 _  K2 W* y0 o' Gns_marquee.left-=copyspeed) {4 F9 j% L: C1 U- i& P/ x
else
2 }. r3 @1 G  E; \' F( Ans_marquee.left=marqueewidth+80 g' z3 U( s& k/ j
}4 y$ \6 B) t( |3 z
}, b! P% V8 H3 z7 T7 @' v* q
8 B/ M" n- n/ c1 z
if (iedom||document.layers){' i. ~0 V, g/ h( a% a
with (document){
+ U1 M) M" k! I3 G. cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% U  Y# d" o* U; X/ s( a
if (iedom){
8 a$ W. p% Q+ h/ {# Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. a1 Z9 Q* r1 `9 c4 ~0 H3 ~* @% s' pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, r' H" e$ C6 g. B7 fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  a6 d/ \7 ^/ |7 D; Hwrite('</div>')8 B" D5 o& W, _/ r. [4 C6 j; [
}
. G! b/ F5 l" v  V$ C6 j/ ?+ welse if (document.layers){
% E1 c) B4 r( qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  `, ^( t* J/ X8 D) `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' g1 l2 z2 g6 C7 n& V+ A5 J5 Qwrite('</ilayer>')1 r& `4 D; V7 |: @# @
}
- h( d* M1 b+ J0 J# Cdocument.write('</td></table>')
5 |/ {- F% z0 y7 P/ b  g5 m$ K}* n3 a. ]3 k* p/ ]. I2 |; f% R
}
; Z) D/ m" |( d! c</script>

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