返回列表 发帖

网页之跑马灯文字特效

//修改宽度% E' g4 z( Z. R- x6 ~9 ^1 x# p  e
var marqueewidth=300( I! \! V; w: }2 C
//高度
& L# c) o* z# E. Avar marqueeheight=253 F! B8 t# N! N0 U. H% v
//速度(1-10)
8 F) _# X+ `; n' p2 Ovar marqueespeed=3
( y: K  _9 ]" S( F2 m9 t3 C& y- x//背景颜色, }* R: F5 b  ~. j& w
var marqueebgcolor="#FFFFFF"7 r5 E+ ^4 m  i3 i  }  L
//是否能暂停 (0=no. 1=yes)?
; }6 v0 N8 V+ pvar pauseit=1
. I/ Q/ N5 G5 R; S3 R/ `5 h/ V# Z* o9 @% K2 o6 ^
//修改显示内容% t0 b! y, t5 q( n; v: G2 \2 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 ^) i  R" v( d8 |( V9 U+ m/ ]& V% I! M* i$ u6 v

# {( G2 Y) i/ R' L: }4 E7 p4 j////下面不需改变////////////9 v7 v% P0 e5 m

9 e; d  |! Y. h6 c7 C4 A/ ovar copyspeed=marqueespeed1 y: G/ h! V2 e
var pausespeed=(pauseit==0)? copyspeed: 0; X( J2 ]7 C5 @/ o6 W
var iedom=document.all||document.getElementById
/ S2 J; g, J6 S- h; x9 q0 F3 Aif (iedom)
; Y+ t0 O0 P% ?% edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ P6 b! |. F, F. ]" ovar actualwidth=''
' Z) H/ h7 l" C" ]3 q  lvar cross_marquee, ns_marquee
7 n9 L7 Z3 G3 f6 N" F# n0 ~4 u; a0 }/ z8 }
function populate(){
& A. i, n+ h" A/ tif (iedom){
9 h8 W3 j( `% \5 `; q; Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 A5 m1 l; r  E+ n
cross_marquee.style.left=marqueewidth+82 S. G, N" w4 Q. v; [  a" ]
cross_marquee.innerHTML=marqueecontent
  S9 W# T  p7 K, I% \. j& s, u7 x0 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 I+ m) t- A) h/ `4 }! ~9 D
}
+ Y1 x' S" k  A" @* Yelse if (document.layers){$ h0 C- q; f+ N  D! @9 m6 \7 K
ns_marquee=document.ns_marquee.document.ns_marquee2  a% C. ~- h0 i3 s: Y
ns_marquee.left=marqueewidth+8+ J- M& G2 L" ]) r8 A" g0 @. [
ns_marquee.document.write(marqueecontent)
; Q6 a. T% g6 T& f3 Vns_marquee.document.close()) F+ H/ O! E/ r% j
actualwidth=ns_marquee.document.width" _( N. r4 ]& ^; }+ B% h
}) V4 ]* R9 p8 V1 A3 l6 ^2 G8 l
lefttime=setInterval("scrollmarquee()",20)
$ q7 U* T1 T4 ~}: }, c. @' }! u. T$ q! U; {
window.onload=populate
2 j* ?% V2 V6 T, n# B
* F7 h) j' c% `$ D" \! u4 `% W7 yfunction scrollmarquee(){& X+ i% G6 F3 G  b: T: x2 \2 F* @
if (iedom){% ]  c$ F4 o" ]- l! |( A# v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 @+ F: I( z7 H3 k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  @5 s2 |- s' F# _- ~8 M8 a9 |, x; Selse
& z% V- |: B5 Z. v4 v* c+ Mcross_marquee.style.left=marqueewidth+8
' `2 J7 f! K- K8 l/ d- D  F' c8 g) c' b
}
. f- L' d# O/ h5 ]- delse if (document.layers){
6 X  C& K2 m3 g' R5 |7 _- `) Aif (ns_marquee.left>(actualwidth*(-1)+8))
2 B1 k7 K, i3 L# t5 D( i9 ]4 Mns_marquee.left-=copyspeed
/ ]) u6 O9 Y6 r. h1 velse
* ~$ u7 X; O4 ?5 R4 M" xns_marquee.left=marqueewidth+8
8 {+ F( l( k! m- v8 l! ^}
' a3 V% N6 f+ v3 D8 y}
0 _- H0 N: o5 F' I7 S
1 o& l  z2 i* D: x. J$ r+ Zif (iedom||document.layers){% j2 [5 U7 ~7 \
with (document){
( T6 o' L/ N& z5 @9 m% Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- T- T  T$ y6 r( W' T& ~  Y8 G
if (iedom){/ [; p! @9 s4 W, Y! U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 C  b" f- e# H6 T: d8 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* x+ S1 {. S/ S( F7 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 e  U% f9 _2 n( ~$ ?write('</div>'): V1 ?2 B0 u6 e3 ~% j5 ^
}
. w% B3 j! L/ i( x* J; }& velse if (document.layers){
3 c& ~( H' S% L4 f: N8 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. }! t8 T& s- K; X3 x  C# uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ l( c; Y& g* B$ ^
write('</ilayer>')
4 _/ W6 `% t0 ^, }& g6 D}$ y# w8 s2 S. S; K
document.write('</td></table>')2 o  G  m* ]2 X4 i0 z8 A' Q
}
2 v4 p, F- F1 T/ @}2 f0 ?' ?+ B, z9 j+ S% C+ w. r
</script>

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