返回列表 发帖

网页之跑马灯文字特效

//修改宽度. ]) `( ]; H3 L9 g, b
var marqueewidth=300
! H. u1 A" i6 g; B# U  I! n# H//高度$ [3 [0 I1 W$ ?4 ^) r6 a* \
var marqueeheight=25
5 V8 {# n3 Y- Q; b+ X6 e: y% K/ g//速度(1-10)0 E" ~  \0 d. P4 y9 c, C$ _5 R
var marqueespeed=3  d' d3 `/ F/ f9 A* c5 \
//背景颜色
  t, v% \% Y3 x7 `var marqueebgcolor="#FFFFFF"& H1 N4 Z* i; ]& B& j
//是否能暂停 (0=no. 1=yes)?
: F- k% N1 @7 @8 y: ~var pauseit=19 x8 W5 L$ i1 X$ A2 m
- m( Q9 A' `$ `
//修改显示内容
$ g# G9 K7 m8 N) `" v, hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') Q$ @8 H0 z3 O

7 W! e: g  p3 R1 l. x
' d9 {, c! S  K4 Q5 e) e) g////下面不需改变////////////, t0 \/ n& g' ^0 }

2 |$ B' A. O( c7 C( yvar copyspeed=marqueespeed7 g- T: N0 D1 r# m2 ?0 }
var pausespeed=(pauseit==0)? copyspeed: 01 y/ \+ s' c. p: K% L: D: [
var iedom=document.all||document.getElementById
$ b# O$ i( N0 N( i6 h+ lif (iedom)
4 Z: B' W) F( A1 rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 y; R3 s/ p4 n) S. Q2 f( {- ]
var actualwidth=''
- Z7 {2 e0 E3 Z0 [% c, cvar cross_marquee, ns_marquee
% N& A1 m# V0 u" J) |7 _4 a& P
/ G: M  L7 t3 s2 Zfunction populate(){
9 B- u6 F  s' tif (iedom){
' q4 {3 y* A! i: |& j# o' o" bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 h- Y7 I7 @: b: Vcross_marquee.style.left=marqueewidth+8+ L7 Y( C/ x/ O, I+ ^; h2 `
cross_marquee.innerHTML=marqueecontent
3 g# s2 Z" v2 Y: j  z# q. S5 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* @9 P8 A- q+ s# q
}. i0 [% e/ v9 n
else if (document.layers){4 c  e) N* u" V5 ~* j. y% k' t
ns_marquee=document.ns_marquee.document.ns_marquee23 `# B2 g4 A! M2 o7 R4 [) O
ns_marquee.left=marqueewidth+8  W$ C& e8 X8 _9 ?# e, r' j; R5 Y
ns_marquee.document.write(marqueecontent)
& ]& ]4 m- l, H5 R3 Qns_marquee.document.close()* g, I/ \; ~0 ]( v7 K9 e
actualwidth=ns_marquee.document.width. i  [* B2 w/ P5 D! N
}' j0 [: x) S3 v2 \1 V# U
lefttime=setInterval("scrollmarquee()",20)" E- A' x) C! z, ^' m0 j1 f' k
}
; R, ~8 R# P( L% Z  t6 Y+ {window.onload=populate  |1 z, N+ M/ F, b/ @
1 k, S! x( H4 T8 X  q0 Q
function scrollmarquee(){
1 e' g, Q- C  ?0 c7 ^; Pif (iedom){3 D2 a! A8 J. ]; h5 w( p. i6 Z% Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ J2 C( @( Z' b1 F9 I, ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( @0 |- O# `1 `/ lelse
  S9 p/ J3 g! [* Icross_marquee.style.left=marqueewidth+86 F) f: x/ s. c6 U

7 e: o' a* e- E9 U# |+ b  j}1 }4 k9 u% D. {# l. s
else if (document.layers){
0 K7 d- T6 o( s5 i( g2 F- b' Fif (ns_marquee.left>(actualwidth*(-1)+8))# f* Y  D& V  x6 A, q( {  Q
ns_marquee.left-=copyspeed
: m. t) P- A; e9 Pelse
  u! f8 u9 b7 v1 L  l  E" bns_marquee.left=marqueewidth+8
3 W6 T# v3 u: i}% W9 d# |; |9 `8 r; D4 u  W
}
* M4 g' a6 C' t( x* d* t( u4 e0 ]. ^" a
if (iedom||document.layers){' k1 `& {4 }, {. _& S
with (document){
4 V, z9 z+ `$ Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 O; |, R0 x  ]2 G
if (iedom){1 q6 ~4 }9 a4 P6 U- K; |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 M2 u' Z$ l. E3 [' awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ?* g) X# I& X: ?+ n; ^! Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' j  l: F, V# T- y5 {1 P) J( z- `
write('</div>')+ _) M- x: K: J7 n9 _4 U) x! }$ @
}! c( T7 E1 s2 {5 Z
else if (document.layers){( e( l# J( j* Q! E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) w* D  B  b! K, t3 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 D) ^8 Y& p2 ?2 Y4 awrite('</ilayer>')/ m) F& S: u. ?! S6 q
}) p5 l4 L3 q' [! _- j. W" e
document.write('</td></table>')
* N, e6 v2 ~2 h' z}6 k( h  t7 B0 Q- @2 V
}* s& D+ H7 L, V  v
</script>

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