返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 W0 D5 h8 e3 V- @  tvar marqueewidth=300# v- t' c0 z% @' k8 D6 m
//高度4 v: c$ y& T+ _" n0 _' r
var marqueeheight=25* U( `8 k* W( _9 [. m1 O7 D
//速度(1-10)4 ^2 m8 m% _, X0 V: i7 \, Y
var marqueespeed=3
% e/ E/ O5 u& j! D0 R0 `0 G//背景颜色! }. x- h6 t, i8 K
var marqueebgcolor="#FFFFFF"; a/ e# L, w% _% w
//是否能暂停 (0=no. 1=yes)?0 n/ d3 ^$ C' R  M. T
var pauseit=1. i- i0 a+ p* f. `5 P, Y, ^

8 `0 {+ o  Y5 C, _//修改显示内容
4 C! a/ q0 z0 q3 x+ Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 ~7 w! a8 W8 L7 K( X7 |
8 z. e; l2 A; a  Q% J6 ?
6 _; q+ b; R# x
////下面不需改变////////////) E+ j7 O8 D7 x" I

0 J, [- e0 G$ d& Svar copyspeed=marqueespeed
9 q# Q0 H# ^& d# i  @var pausespeed=(pauseit==0)? copyspeed: 08 p8 R2 p, {9 C2 @/ I$ o  R) N! p
var iedom=document.all||document.getElementById! T+ B) {1 i* [7 U, C& H
if (iedom)
9 D- Y4 n) W4 `2 v: X7 }, ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( c! S  W, x& v* F& o$ a9 J" z# R6 U
var actualwidth=''
; H6 I2 a" A! g) p' |var cross_marquee, ns_marquee
: W5 m1 Z* H1 x8 X" I. W* V8 l3 _
9 e+ N6 b% n) v4 i6 g$ Mfunction populate(){$ Y! B+ Z2 r2 h" I4 v+ s7 {9 Z
if (iedom){. \* ^6 q; b5 \3 K+ A# u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 o& [1 y- X' V: @3 ]0 [cross_marquee.style.left=marqueewidth+8: l" l4 i4 i$ W  U# g6 ~6 T3 {
cross_marquee.innerHTML=marqueecontent
9 W# s/ I- y9 u; @5 iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 c" {" V4 V$ F0 q}2 X  @% }7 ^2 k: e
else if (document.layers){2 g9 r# R) w5 M* ~
ns_marquee=document.ns_marquee.document.ns_marquee2( x$ D8 P" M# k8 ~/ t
ns_marquee.left=marqueewidth+8/ q& U* s% v. {7 {, w
ns_marquee.document.write(marqueecontent)
' W4 F( ^. i' a0 R  a; y2 y! cns_marquee.document.close()
  l; `+ J$ D  b4 |1 s5 `7 cactualwidth=ns_marquee.document.width
8 S, q8 I* C2 d}
! P' u+ m: [) @: B6 jlefttime=setInterval("scrollmarquee()",20)5 B  Q1 R* s  p1 U4 k6 }8 w
}
! H1 _9 v! E5 Y* z7 G% l1 Lwindow.onload=populate' p4 Z4 s+ _% w* T% Q
. a+ G2 b4 Z" D- [& j
function scrollmarquee(){6 b" y6 Y0 P# ~/ K
if (iedom){. v# H$ B/ c( C$ H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 j- {0 j# T# z5 Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 n! m, U+ D# O# Relse
) D9 S6 W8 W. A- j$ z: t# I6 [cross_marquee.style.left=marqueewidth+8
! R' M/ n) P0 v2 ~, v! L" R4 F
6 J8 R, S3 N1 R+ E}  L# ^  t2 e; v2 f9 s
else if (document.layers){( @6 ~7 i8 v4 b3 @* i
if (ns_marquee.left>(actualwidth*(-1)+8))( d5 O+ A' Z4 B
ns_marquee.left-=copyspeed/ p2 J- p0 o; V1 L
else
" e8 F* K0 H1 [  N! C1 yns_marquee.left=marqueewidth+8
# W% C) ]" x5 H2 g}) V7 Q, x2 C6 |* ]6 Y
}8 G5 t, Y: r9 }, a

, R8 N* _( a2 t- y# ?$ ]6 v( aif (iedom||document.layers){
7 b  a; X3 V, H# z* K4 u# rwith (document){
" n: I/ p& _4 Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- q5 Q% ?& Z; hif (iedom){1 Z2 l# H, @/ S! A7 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 a, \( f4 w! |4 p! g' O7 v; p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% X/ {$ {/ @2 o' h' V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( A0 W8 q5 @/ ~, N2 ]6 k+ X
write('</div>')
$ M  e/ J/ H4 t- D, Y! P}
* y/ }; K+ r0 O) e- yelse if (document.layers){8 X& t+ {0 G5 n4 s: c9 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# }, r* a) L4 r2 M8 ~' y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  |# _. j5 r& ^$ N: _
write('</ilayer>')# k# ?/ X! e- X! J8 a( P
}  K' k9 `  S1 m: y/ v
document.write('</td></table>')# P' l/ Y$ U: B7 z1 m
}, t/ ~2 v* ~3 }5 @, b" A
}
+ G7 \, \5 `* d* L, h9 Q</script>

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