返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ t$ \: x+ c+ n2 ^- F  J! G& zvar marqueewidth=300
' A: Y2 c1 y$ u//高度7 q/ y0 k# I: T1 n+ z/ I' p# {$ D
var marqueeheight=25( u2 U/ {" q* W3 d$ U! u- r" C
//速度(1-10)3 }2 s" I. x* _1 Z- L/ y1 A
var marqueespeed=3
3 k" q) _2 W8 v: N& F* y4 |% a) K//背景颜色
% H( c9 z0 f% ^8 e) O: k- evar marqueebgcolor="#FFFFFF"
6 g& q' a# V9 b0 Y& l- [//是否能暂停 (0=no. 1=yes)?6 o7 E2 I. g7 _& v( w2 [! ]4 `2 O2 I( o
var pauseit=1; }* F; C4 |) }. P& k

$ v/ ^: G: O$ t//修改显示内容0 J( d. l7 I6 K  Z8 r' J5 ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 I1 K* i3 [- F+ g

! V. c8 @0 k5 t. v: o' R9 f) y8 Y9 ?# n4 p$ i: w8 D
////下面不需改变////////////! g, A* l6 L8 X, f

" ]( z6 N$ u4 H2 j! Cvar copyspeed=marqueespeed
8 V5 {( R; A6 K  j, evar pausespeed=(pauseit==0)? copyspeed: 0! C" o, u) i1 v8 v+ p2 Y. [
var iedom=document.all||document.getElementById
% y% Y# r) k/ J( Dif (iedom)
7 h8 S1 H3 H' Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 n" X$ i* |- g) l# Hvar actualwidth=''
  H( A, ]3 R6 A+ W9 Q- \- Ovar cross_marquee, ns_marquee0 D* D% P, O2 s% z9 @
1 ~: ], s: p$ v  ]+ D6 X2 v
function populate(){1 Y' @8 F5 X! V8 b) p) o4 ]
if (iedom){
9 ]8 x: p4 k' X0 scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 D# q9 J5 R+ K1 Q  scross_marquee.style.left=marqueewidth+8. J# ^1 c. r0 \
cross_marquee.innerHTML=marqueecontent5 s7 b3 |, O6 l) J7 ~# ^& I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! {' B6 y  ~, {) o* d
}
$ s7 {8 A/ D* a1 Y4 Z% P8 Zelse if (document.layers){8 f( E4 o& _& v: J$ ?' F
ns_marquee=document.ns_marquee.document.ns_marquee2
- p( f3 p, V2 u+ t6 h! uns_marquee.left=marqueewidth+8
3 }; S; J% X2 X3 u0 T8 vns_marquee.document.write(marqueecontent)
8 L$ M/ Y0 a2 ins_marquee.document.close()
7 Z3 {, i! \  X! factualwidth=ns_marquee.document.width
2 Q6 j% s2 B8 M}, U) v/ y+ ], _  t% |  V
lefttime=setInterval("scrollmarquee()",20)) F* c  b" l5 w' \( t' R" K
}9 |& k. S$ z7 R' S' F) ^
window.onload=populate
8 z5 k$ ]- E" P) @5 C+ x) G
6 I1 ^6 Z7 v6 ~& J0 ?function scrollmarquee(){) ~( T; I+ c* i( X9 ]3 Y- z# y, @# C1 X
if (iedom){
) M2 `5 j! `0 z' l& ]; k- o) Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 K- R+ ^! m8 _' V' m) ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 ?+ F5 O. Y* ^8 v7 Pelse1 Q6 W, {7 h* n2 @# j; H! [+ \. b
cross_marquee.style.left=marqueewidth+8
2 e6 _6 P" P8 I5 Y$ \- H! z9 A1 d3 O- h; b; {  ]
}
. a/ i) E/ R  `% h, s- celse if (document.layers){: M( P7 Q- w0 m# D2 N
if (ns_marquee.left>(actualwidth*(-1)+8))
, f# P& O+ @  }4 o, T, Qns_marquee.left-=copyspeed
1 D- p; q1 F% ]8 A' k$ _1 o0 velse; J. v+ X' h( `+ S" ^3 |
ns_marquee.left=marqueewidth+8
7 M5 h" j* ], i8 C! o6 [}
; g# d- a: r* a4 k% |}
' s  @  l; d- u
( a& T" T5 ~/ `if (iedom||document.layers){* n8 a2 l' s5 |! D) J
with (document){
0 e9 p  }  ~8 b9 M5 Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 P( ]2 L" ^$ h! \  jif (iedom){
& U1 c0 m) w7 x8 R) T$ I# Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. R1 R- L9 A& T* Y: `  ]+ ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) ~: _3 d2 w0 p; J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 }  f. E' H5 S" N4 g; `
write('</div>')5 d  O+ ^% B. U. \6 b4 m+ q
}
+ d$ E  @% n0 Z" xelse if (document.layers){
8 Q6 @5 X' r; w' l, h8 v- Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 B5 {4 v9 {, k1 |' r7 W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" ]6 v, O6 W' Q  D: U* Gwrite('</ilayer>')
% B/ K' w+ `- @}
1 j+ H1 d8 H9 rdocument.write('</td></table>')
4 s. a5 Y4 a: f" c( s) O}8 [9 |& k  T) v, J: Q
}
/ O+ n/ d( H- Q1 c</script>

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