返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ w( {# j9 ^5 U  I% S# e6 e
var marqueewidth=300$ o% D* K. C0 @+ L
//高度3 C8 P2 l) a/ T/ R, U2 M
var marqueeheight=25: C5 p& M" X* D  j& ]3 A
//速度(1-10)
9 k. i" u/ F- ?% a! x( i- jvar marqueespeed=3
- _" ]) p: d& v+ K, c6 ^//背景颜色
; Y1 v1 r' t! u& j- H6 W; ]  f& Xvar marqueebgcolor="#FFFFFF"
" m8 O" v" u- B# n1 k//是否能暂停 (0=no. 1=yes)?# K* j# _0 t9 x6 U4 G1 \) F' L3 Q
var pauseit=16 }) I2 C9 e4 m: `+ N

, |7 \6 z, _* I3 ]) _- f9 Q//修改显示内容
- z/ z4 a) B1 H# n) wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 P0 L9 z2 m2 L
) ^! d$ T6 a8 w7 h6 I7 ~* F# ^' J
( ~. \: N/ z# V" x
////下面不需改变////////////, |+ Q* p- r; J- s3 }) n$ a
$ \* G/ G# ]8 S" X$ S
var copyspeed=marqueespeed
8 r( W; }' Y. bvar pausespeed=(pauseit==0)? copyspeed: 0
+ @# I, G4 r8 Uvar iedom=document.all||document.getElementById0 @( p# I6 |3 H
if (iedom)2 ~+ B3 ^9 n& |: p3 y  H/ u' A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, i7 W0 z1 L) e, }% I! |, h, rvar actualwidth=''. n* V; @4 s& `0 x
var cross_marquee, ns_marquee6 M; B# h) R% E% Q1 B& g
0 S7 f# q0 ]6 A* y# F8 u6 a8 [
function populate(){
+ @( j0 ~4 V  t4 q4 Q) kif (iedom){
/ b9 C+ f8 q0 i3 C! `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! Y) o. V; D9 O$ i( T& F
cross_marquee.style.left=marqueewidth+84 h/ [& p$ ]$ ]& @1 r3 f4 g
cross_marquee.innerHTML=marqueecontent
& B( E# D+ f/ Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ g* z" `" |) g  l+ x# ]: |}
0 a3 T0 J8 l, _else if (document.layers){
, {# a5 ^# V$ }$ T8 cns_marquee=document.ns_marquee.document.ns_marquee2+ }$ |  t, F# I6 z" V* |% |
ns_marquee.left=marqueewidth+8( E# q# v1 E- N) v4 @# v" `' |
ns_marquee.document.write(marqueecontent); S; M# Q: [# h$ U/ |  z8 t' y& c, H
ns_marquee.document.close()
7 t, ^3 f4 @) }& i+ [1 e7 S8 H0 B# vactualwidth=ns_marquee.document.width" V! U/ B* v8 O& u
}
/ I% H/ V4 R, z  ~/ [lefttime=setInterval("scrollmarquee()",20)
! W. `  l1 B& r3 i, `, K0 `}) }) [! y( w; u+ k7 J
window.onload=populate" T8 F: O1 S0 R1 O6 u# x/ c

5 d' p: ]/ j7 g- ]0 b2 xfunction scrollmarquee(){
. \: I. Z: q6 t2 tif (iedom){
  U/ J+ g4 H& v, mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 H2 w# G( N# x; g" {, o: q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  @5 d% Y' Z$ Eelse
8 D0 p5 p( H: [) g( x' {# l8 J! Jcross_marquee.style.left=marqueewidth+81 |% ~& o' r! q6 |" ?& c9 ~

5 d8 T( E1 v  W8 h; q5 r}
1 n5 O+ h; c+ n) @+ F. f3 melse if (document.layers){8 B- X2 o' s8 P. n# h+ J
if (ns_marquee.left>(actualwidth*(-1)+8))+ C& l$ f; a- U/ v
ns_marquee.left-=copyspeed. d& H' ~/ z% L5 y
else( |) Y+ @& B, W3 k
ns_marquee.left=marqueewidth+81 K( ~9 O+ }/ ?4 _: H) q( J
}7 W5 u5 i+ \- u( ]- s
}
, E/ m! l: z+ z! t/ x" d1 |
7 R+ S: o& P7 }/ E! [8 vif (iedom||document.layers){; F, X) C  m/ w2 U4 F
with (document){6 {, Q" }. @) ?8 i/ V# E! u, U; G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), X6 ^9 s6 }! b
if (iedom){" @8 T8 {; ?- `/ [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 W  D  p5 O; ^, a# R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# K. l. j/ Z0 s4 ?& G% s& X6 nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 x, [4 s) j* |; R9 kwrite('</div>'): v, M- G0 z4 p( K7 f5 ^
}: A/ r4 F- D9 M3 X
else if (document.layers){: g0 X& o5 Z* ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 b2 X# e4 \8 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): \9 c5 w5 b+ c+ C; {
write('</ilayer>')& c7 z! N5 E8 o
}
, \! G" x5 w* m5 odocument.write('</td></table>')" a9 I7 D- p; s
}+ l# f, m0 `+ o  T. R# C
}
# d( f& E( X3 _</script>

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