获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ K- A/ f$ t( ?# a  b
var marqueewidth=300; k9 s+ \; l# [$ B1 L
//高度
) G- n0 _- z; |, k5 K3 nvar marqueeheight=252 U, t% ?" L8 W4 f" }
//速度(1-10)
* o! _  g: t7 S; M+ K- e: X' cvar marqueespeed=3
  \$ ]0 w# I2 Q8 ?6 z2 ~' \//背景颜色
  a% T- ^2 ^9 C% |/ ^var marqueebgcolor="#FFFFFF", O; }1 z$ }* w% V4 F* H8 D' F
//是否能暂停 (0=no. 1=yes)?
7 R; g3 W% w. h- x. f, m/ ~var pauseit=1  R/ Z  [# n" e# }$ b
# L7 [5 l. W" Q
//修改显示内容5 W$ p# l$ E6 t+ f$ X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" f% X/ W% c3 |1 @9 P' `
: t5 ^, v4 Y9 d8 \& c2 X: S0 C, _& ]6 V) S
////下面不需改变////////////" R% U1 l, O5 q6 v2 Z
6 q. D+ z1 e5 i6 n3 k7 u
var copyspeed=marqueespeed4 D2 O, w0 _" }7 {: j1 g+ ~
var pausespeed=(pauseit==0)? copyspeed: 0
2 j* D5 A- D5 i/ A0 D& f* \8 _var iedom=document.all||document.getElementById3 ]5 R! S$ N5 x, z1 Z
if (iedom)
" J& g9 N" w- ~6 j  [) U  Q  kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& `6 W' O, Q$ k. ~* d# jvar actualwidth=''9 ~: v; _# x3 v! S3 \$ v8 e( o5 x
var cross_marquee, ns_marquee- D5 k+ T; g8 \$ O* h# g
6 d0 J/ ?( b, S: ]4 T' W
function populate(){
) I& B1 r2 a. w* iif (iedom){% W5 E$ J' A9 i3 _3 }, `1 V6 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 g; p& X' _- P5 Q5 d/ X5 C, x7 O
cross_marquee.style.left=marqueewidth+8
) H/ E3 t7 F" Kcross_marquee.innerHTML=marqueecontent
! z. c6 J, d# C" F& \- [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 u8 ~8 h4 d4 a5 \( |* `, w7 g}5 h# o5 d8 f' }0 {8 p9 x
else if (document.layers){
! ]( B3 C. Y* E( E0 b0 e0 Ans_marquee=document.ns_marquee.document.ns_marquee2
. p; }2 U( o& U, Q, i2 }3 Bns_marquee.left=marqueewidth+8
2 @+ K2 ~/ a+ ?- p0 V6 B/ lns_marquee.document.write(marqueecontent)  J( y6 r0 x7 i- W* y
ns_marquee.document.close()8 U) [8 T$ }4 F, X: O
actualwidth=ns_marquee.document.width
, U2 l; V% U# j0 ^}9 H/ x/ N# N1 s( ~! S  z
lefttime=setInterval("scrollmarquee()",20)
; ~# K6 }. `6 `$ G1 R}
) H0 ?& v- a8 l$ W0 a3 Jwindow.onload=populate
3 G0 Q3 h& l# I4 Q+ g
% o0 E$ U+ J; D5 s: N2 ifunction scrollmarquee(){' p/ E) R) H3 V+ I, t
if (iedom){. d# @& l. p1 a  z; ]* n7 j* [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! [) k% o. U4 j# D0 F6 W& j4 P' ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) R0 i% i/ b7 J$ C% W0 f, y
else
' x7 x$ g3 L$ i( b+ Gcross_marquee.style.left=marqueewidth+8
# ]" {5 S2 D9 J8 H  s1 C! \* @" ^3 j1 I' h, v
}
; e4 M/ ^) i* F  l% z3 @else if (document.layers){
; G2 k0 s2 _( L+ gif (ns_marquee.left>(actualwidth*(-1)+8))% C9 m, |: q. ^" e. t
ns_marquee.left-=copyspeed3 O. i# x+ g# D. j
else8 L0 u' l0 \' u( ~
ns_marquee.left=marqueewidth+8
* ?7 v$ M+ Z5 H- C}
3 H9 d. H- x; r9 g8 x}
# Y. v& J& i' P9 z- k8 g; \' z
: h/ F: ~9 Q, |* X( O6 u: Lif (iedom||document.layers){, T$ E* \$ v; Y# |% [4 J3 b
with (document){! E1 b7 h& ]3 D  h( u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! m% p/ K$ W7 _+ G& I! u& O- a
if (iedom){
" p* V. k4 v3 g/ r$ ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( g/ G2 n8 ]+ g: c7 |% M" n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 q* O. W1 B7 [+ l- `/ I* e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 d( P; J, w( m& T7 c# T+ ?, Hwrite('</div>')# ~% o# J! e) h6 c& M7 h
}: s. u3 }5 ^: w) K& f
else if (document.layers){
0 a1 W/ v3 f* x  o. Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 J. ^& N+ ?8 G4 e2 y7 T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' }' F- y. |, Z- P" rwrite('</ilayer>')
9 D, U" |$ Z# z; \! o9 j5 V}
9 y4 |+ R" [/ E5 K2 n( ddocument.write('</td></table>')
0 A% V) m  e$ U! I* ~8 _}, E7 U8 _( u3 L
}
* j/ W( ?9 j" K! b( s: c' g' k/ z0 d</script>

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