返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 M; `8 X5 H& v4 F  A3 k
var marqueewidth=300
8 y/ x4 L: S0 B//高度/ p2 v2 ^. h+ j! x- Z" h  I5 A
var marqueeheight=25
; L5 z# ~3 I  m2 k. f( i, |//速度(1-10)4 k/ R9 s9 P! z2 L
var marqueespeed=3
4 G3 u1 ~7 b$ S- F: X: X# @5 n+ H& z//背景颜色
& f6 [( N4 U- C- `  Hvar marqueebgcolor="#FFFFFF"& x: z8 K* C( z' K* ?
//是否能暂停 (0=no. 1=yes)?/ [# Z# N' m' ~; d
var pauseit=1
& V  u; E+ q& R" O# L+ r' c1 q/ l/ Y* A3 K
//修改显示内容  l* Z- }! S9 ~) w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" Z! j# H) }( j5 X6 L8 A% G( t& i( X! }  M

. ^. n: f4 R1 I; N. W- G1 G' A////下面不需改变////////////1 T9 i4 `! m0 P7 r# z9 n
) c( X8 T' s$ u) Y# X
var copyspeed=marqueespeed% L9 m! I; O8 y8 @$ b6 A
var pausespeed=(pauseit==0)? copyspeed: 0
9 [6 |' L% i% \  xvar iedom=document.all||document.getElementById
/ r2 j1 N" b8 c+ `5 Sif (iedom)
# m4 ], w9 K; l1 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ w0 K1 J( H' Q( N, H. c
var actualwidth=''
' p( T" Z% O% y* ~+ p- xvar cross_marquee, ns_marquee1 Q0 H$ }* `. a  p0 {) U7 @( N

- l7 X- k: y, ?0 V" G8 pfunction populate(){
2 R9 ~8 Q& ~' h" G2 d8 uif (iedom){
& f" W( G; c" ?; r( rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: W, y  F$ ^& S4 J! ?
cross_marquee.style.left=marqueewidth+8  R. V- T4 U) a; o3 {3 X3 d
cross_marquee.innerHTML=marqueecontent
1 B. X, S) I- iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; |2 U% Y3 Y# A2 Q; L
}" P6 \# z/ o5 j; t6 q) H
else if (document.layers){. k+ b% Y+ I+ h' w
ns_marquee=document.ns_marquee.document.ns_marquee2, i2 N7 l) N3 V- V0 W( `
ns_marquee.left=marqueewidth+8
7 F7 U7 D+ A3 U& a0 Q3 L9 b( Lns_marquee.document.write(marqueecontent)  g1 b1 h) E/ L7 O
ns_marquee.document.close()
( Q0 d+ `5 u8 Oactualwidth=ns_marquee.document.width8 b# z. n+ i  q" U
}
% d- i- ^3 N8 ^3 S  j; nlefttime=setInterval("scrollmarquee()",20)
" a! t6 m& r4 X( x/ K( v1 Y}
! v# n7 T, F. B/ \! h8 M. _# Qwindow.onload=populate- @" U' O1 u  u
4 O! G2 q, r/ ~0 _4 W# n/ y
function scrollmarquee(){
8 r. ^  M4 Z- o) C' I  Aif (iedom){, B6 P- l, e$ ?. w4 w. o: Q- B; J$ [3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" {$ y0 Z4 h9 c+ Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' d% W/ }/ {% E  v7 I( A4 x2 R9 B9 R
else
- M# Y$ P& N. a+ m3 ?( A8 gcross_marquee.style.left=marqueewidth+8
- E! ^. q+ T! Q  u0 e7 c& S8 I7 [  ?0 I! n, L& a
}) q8 T) d! x( R; k4 J
else if (document.layers){
  ?2 O& g1 h# Fif (ns_marquee.left>(actualwidth*(-1)+8))
( V7 n: P' j! |) M& N' `1 Yns_marquee.left-=copyspeed
0 Y) @: g# G7 }# \; F* Jelse, D6 p1 E8 y4 l3 x" x7 S6 t- T$ u8 ?
ns_marquee.left=marqueewidth+85 i5 n9 t  w- C0 L
}, Y$ d+ T0 s& _0 t6 u" j
}
3 E( w' ~. n$ _$ w
. V, U, Q, E, P0 y' fif (iedom||document.layers){
! E9 E% Q, L3 X5 x# Kwith (document){* {' W- A+ B0 Y$ V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  |# g4 E( Q/ g% Q/ K
if (iedom){
/ J- y* r4 M% ^2 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- X7 X8 a2 m  K  ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 c; c8 f7 x1 y* T" o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ D" y/ ~/ q. N6 _9 A& A. Z. l. Kwrite('</div>')
) e) m* g  T7 P! H! c% A; Y  i; j}3 a1 B! h& g( Y. h, R4 p" A
else if (document.layers){  k2 T- Q  n' w4 M" g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 P0 W9 P8 U& Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! b* t9 k5 L' q1 e0 e7 O
write('</ilayer>')) O- G3 a4 R0 E) ]
}
- a% M& `7 e6 v: J2 c- I$ Tdocument.write('</td></table>')
  t, T% B- k  {( _* Q& W) L3 D}
% h0 z' Y% [$ H8 |+ {8 m# F}. R. E1 ?4 k4 H' I$ Z: |, \  z
</script>

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