返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) L+ {0 Y  b- {var marqueewidth=300% h- B; S! C2 G- K3 k  |
//高度
, i% S5 S' I4 Lvar marqueeheight=25
, x! }  c8 T( w3 ?( E; ]//速度(1-10)
* T  K8 a, ~1 g$ \var marqueespeed=3
5 ~1 v+ m$ D2 k/ F4 V//背景颜色) q& e) O. e5 l9 W
var marqueebgcolor="#FFFFFF"! F7 I6 d" y$ p0 u% e
//是否能暂停 (0=no. 1=yes)?# T! k! Z+ a6 N6 [
var pauseit=1
, y& w9 }: y# m1 u! e
6 B4 U. k& ?3 T8 a) w//修改显示内容
, V: K) G+ R! Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 T6 k( l! j& C3 d, ^' o
  k( W! H. R/ A" t. m6 i1 k! w, J  `4 z( e  _- V6 a& e
////下面不需改变////////////* b' i) _, a* w0 p9 Z7 y! a% j

- j+ ^1 Z& d0 D" ivar copyspeed=marqueespeed
$ D# e0 m* T2 ovar pausespeed=(pauseit==0)? copyspeed: 0
4 ~+ }+ d, d! y/ Z- cvar iedom=document.all||document.getElementById6 S! [- Q5 v; ?4 _
if (iedom)- a( d( O6 F$ [* }2 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). l4 i5 {* a+ \5 ]2 g
var actualwidth=''
+ s* k6 [9 Y) K5 r# g# \var cross_marquee, ns_marquee6 _8 Z/ S7 N- S% O; X: `# n
; N' b6 @! ^- V6 S; f4 m/ M1 z+ R/ f
function populate(){
% [5 `# P* ]! h" N5 h- R2 k! oif (iedom){
$ ^! f- h7 N) {( p, u, l% J" Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 M$ m" R5 x' }; q, q; Fcross_marquee.style.left=marqueewidth+82 e- d3 W! O) B0 F# D
cross_marquee.innerHTML=marqueecontent6 H  T( P3 g+ C6 `$ ^' k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 x4 Q! ?) p3 I( E% ], k# C6 _
}
& u8 S1 ~$ A" E! Telse if (document.layers){
- m3 n; S, C  F% @# _- N1 t" u+ }' V6 vns_marquee=document.ns_marquee.document.ns_marquee2$ l" ?. ~& k* U' O* f
ns_marquee.left=marqueewidth+8
$ `- i! x  [" a3 Tns_marquee.document.write(marqueecontent)
  _' C9 R% {; i9 d5 p% a+ Tns_marquee.document.close()0 E; |* u, d# ?5 R, O4 ~# E4 {2 j' c3 d
actualwidth=ns_marquee.document.width' X! V4 f: t; r7 l% H
}
6 r& L- b! B) d( g6 c' _lefttime=setInterval("scrollmarquee()",20)
, b, x" |/ [/ j& I, ?}
( x8 m9 g7 _- D" M; l. [, n( u0 C( t# rwindow.onload=populate
0 s. p4 T" a: X0 x) R& z
& n3 }  X5 o' l* Y! vfunction scrollmarquee(){
, k0 G9 ^! a* H# S4 ~/ }9 oif (iedom){! Z  ?9 ~6 ^; S5 V/ H7 b: |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 P9 u& l. c/ p( b( E( Q) C& T5 I+ D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! V8 ]) Y; m$ |* o  b5 O  r
else
4 a+ R2 |% C9 d4 Tcross_marquee.style.left=marqueewidth+82 ^1 t+ r" d* `( q0 F- ~# b
5 C# L% z! |5 A8 D
}
- f! A$ ~" A+ [7 E% @. felse if (document.layers){
# U# V1 E  {3 M9 X1 N# _% Dif (ns_marquee.left>(actualwidth*(-1)+8))9 x% C1 K( `5 u2 j
ns_marquee.left-=copyspeed
' x# l' w4 x3 Selse. G% b* C/ j4 k0 |' h
ns_marquee.left=marqueewidth+8, g+ Y! m5 B! x; w
}% ^% ]: E; e$ d" p0 `
}5 S/ \$ b8 B& v4 F
: G0 V+ X! {9 |. G. V. V+ i
if (iedom||document.layers){
6 C7 B# b9 x2 R+ n  y; _( z5 p) ywith (document){7 E6 P# K; R- @$ V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. R) n  t1 j& O: Y! n* tif (iedom){
  Y1 t# |& f9 e( M+ G9 N+ ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# M& I% E0 ~: C5 k) u' q3 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  q- }( a% B- M: M" L" \1 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 U, |( y; I, R- T) L# ewrite('</div>')
( m, i4 h$ c3 j}2 b6 g1 x- `* |7 k; n# {" w; e
else if (document.layers){
' k& G. f& _5 s8 c4 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  O3 z  I2 B( x, h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& h1 X  l4 v; _. {) J9 C6 P
write('</ilayer>')& W& M- C" K3 P/ ^
}
; J  w# ~" f* s# c2 Vdocument.write('</td></table>')
) w9 d# O  R- j9 g: n. y# _( v}
, z! _+ |0 d4 _9 ~6 [) u, B}6 f9 E! J7 D. T
</script>

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