返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. j! M0 d+ V2 m# H+ evar marqueewidth=300
0 l7 {+ ~* a9 Z  b! P//高度
' l& ~9 {* D; f, m% kvar marqueeheight=25
" e, Q* ^, g' @; f//速度(1-10)0 B+ g; ]" F" g! u, m' b  ?/ z
var marqueespeed=3/ o3 @/ w3 z* Z4 u" X
//背景颜色6 h1 e1 _4 U9 f! g6 Q  F( ]
var marqueebgcolor="#FFFFFF"6 X7 m7 q; l/ f& h) r- U' a
//是否能暂停 (0=no. 1=yes)?# I& E8 B2 ^0 [" ]! N$ a
var pauseit=1, ^* X2 k* `% L, H. m, h% B
$ @- L' \# F/ a0 d
//修改显示内容, [6 h# x3 f" `/ B( `8 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 S/ J* d% L3 y+ q3 ~5 }- K9 p8 F

  U/ L& U6 i/ V; w
/ W0 y4 e4 r! M# ?/ @////下面不需改变////////////- }  I1 m! N6 e" n

: ^& z* b6 B2 uvar copyspeed=marqueespeed3 A! _/ y4 @. T3 ~+ X
var pausespeed=(pauseit==0)? copyspeed: 0. ?- W0 R0 Q: ~: \( H" e' f* Q
var iedom=document.all||document.getElementById% c0 o% O* q3 y) l  V
if (iedom)/ H; M2 y9 O" c5 O, p9 V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* B# }0 z+ j- @- |+ Qvar actualwidth=''' h; V6 t1 L8 i
var cross_marquee, ns_marquee, F0 z( X# H$ P  X6 t
) M6 h  j4 q/ l0 t
function populate(){) ?5 c/ l& U. X6 o7 t$ ?) t  C/ ^. g
if (iedom){. u& S/ T+ R/ v# v1 h2 v- F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. i( |5 f7 S6 m6 Y4 Fcross_marquee.style.left=marqueewidth+83 k) c- X- q' q
cross_marquee.innerHTML=marqueecontent( [9 T# L6 s8 |2 G( T* q6 M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 a' x4 b: ?6 k% H  z' b. I" M}: N5 A) M' e$ t$ ?: \+ q- |- }% X
else if (document.layers){
4 A) `; I* _) w. w' ]ns_marquee=document.ns_marquee.document.ns_marquee28 q! w% f, w2 N0 {
ns_marquee.left=marqueewidth+8
% w/ U3 y3 ~( _ns_marquee.document.write(marqueecontent)
7 |8 |( `2 D. Z) ~ns_marquee.document.close()( P: f" K, N& h" m; H  p; j: S2 G
actualwidth=ns_marquee.document.width
2 p! Z* Z# A4 R, `  A8 ?  n}
4 P# M, W) {- N) x$ Zlefttime=setInterval("scrollmarquee()",20)
/ w5 x& j0 s" |4 I& J}
, j2 N9 I% P! M, e# U3 ~: Xwindow.onload=populate
, G8 {' q4 s! z: ]+ J, H9 G! }& [4 d/ g/ P& g9 v7 ^
function scrollmarquee(){0 x7 S: M8 O7 r; {6 z7 I/ C
if (iedom){
) o+ U/ T0 G; u& N7 f& E1 Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& S3 {; D% R+ f+ Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  e4 f0 [! |9 K, U" Aelse1 ]+ E; g. c0 ^* I% y
cross_marquee.style.left=marqueewidth+8
+ G9 y- ?0 d0 ^& Z% T( u3 C) N+ ?2 _# M7 k4 y
}5 X# N6 O1 j$ }# |9 z
else if (document.layers){( ^( b/ C6 j9 H1 `8 @- y- h
if (ns_marquee.left>(actualwidth*(-1)+8))
6 i' y/ b5 f0 Y8 D% ?6 ]4 c% Ens_marquee.left-=copyspeed
3 d) E# p9 w5 Y: _3 ^' n$ P8 delse
5 x3 `) E, ]- v8 t6 `% |5 d3 Zns_marquee.left=marqueewidth+8
- t( z1 P7 n! y7 A9 X) c  I}/ |) P4 s5 b( C* o
}/ N# Q, t+ _( n1 q

2 Y8 ]$ U$ N# @$ R* mif (iedom||document.layers){6 v6 K8 j8 k1 f' _9 F. _
with (document){
! P  V) ]/ ]% ^# v$ t7 j6 ?4 L0 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 b7 ^3 Q, W1 W0 D5 wif (iedom){9 g  g- B7 C6 F: f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). N5 ?7 \' h, T: O6 y4 G1 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ~, M$ L' y. E% Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# A8 Y- Z! m& L! b: \* Y+ G' swrite('</div>')
; c* B& e1 A- `: M& J$ Y* a}* L# a" w' M9 x, g! D/ Z
else if (document.layers){
7 @5 n. n2 ], A6 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 f- C" p  X! ?6 {" N$ B- t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% w) z5 O1 U$ H1 J8 N0 [" n8 o7 o
write('</ilayer>')
- t5 q# _5 q: B. z}
6 O4 j+ H/ j- M7 {- c" @# xdocument.write('</td></table>')
/ h) F* E) X& ]9 u( L}
4 N: W& a7 X( M1 L# }}
: {3 `- @9 Y: G+ P</script>

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