返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 Q* Y- M; z9 X& W
var marqueewidth=300
5 h8 U5 Q1 j$ o* Q- p//高度
) d/ j9 i6 \- Nvar marqueeheight=25
9 F. \5 r, H  h3 c  ^//速度(1-10)
. e9 O( s$ D" y. V# X5 [# G: Gvar marqueespeed=39 c# H$ H, {* N3 Z1 a& G
//背景颜色5 s8 W8 S, O! f1 s
var marqueebgcolor="#FFFFFF": J0 ?! f3 @# x$ u! r) M
//是否能暂停 (0=no. 1=yes)?/ s$ v: D7 w1 T8 }. C( C" O
var pauseit=13 [$ J  k! s8 u; ?3 h$ A9 r9 K; r

/ U0 L5 s% G7 y* m+ @7 b$ g//修改显示内容* b' s1 O. F( |' N  d" t  D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 }( |0 s* r$ v4 B. ^' y5 u* c5 B7 A9 E
  t) K6 c. t6 m9 E$ V$ s) k4 C
////下面不需改变////////////0 i& S3 r* N' T/ s
0 r$ ~9 m, t/ T, L2 ~9 ~6 o
var copyspeed=marqueespeed! A& A/ U. O% {9 r" ^& K) q: b
var pausespeed=(pauseit==0)? copyspeed: 0
" y3 \* m6 }' wvar iedom=document.all||document.getElementById) Y+ m8 u2 B4 S. p5 u! H9 _2 Y
if (iedom)
8 S6 }8 b0 i& k7 j( O: e4 N, edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 }6 U; {9 S/ F+ c/ U6 K/ Lvar actualwidth=''
6 S  A! H6 p' Y3 K- F$ Lvar cross_marquee, ns_marquee
0 q9 z4 s+ f' _# O2 s3 M; ]8 x5 {
, R/ s1 a! t- vfunction populate(){
7 {# V3 P+ D" F2 i2 {( L4 mif (iedom){
3 |. n7 m; j. n3 {9 w7 L: |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ G( Z, k( ]  @  b. }cross_marquee.style.left=marqueewidth+8& v% K# i. V. M0 p8 a
cross_marquee.innerHTML=marqueecontent
7 N& c. u* }+ H* P& qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  k' |. W, T" Y9 v2 B. {; B}
4 _- j4 o4 I- W$ Qelse if (document.layers){- t3 I/ k/ z1 ^0 z0 i
ns_marquee=document.ns_marquee.document.ns_marquee2
' k; ]3 u' W: Q! z$ [ns_marquee.left=marqueewidth+83 u9 d! e3 V* \
ns_marquee.document.write(marqueecontent)% u8 R) [/ p3 ?, m+ U% O, V
ns_marquee.document.close()
! D, J4 }6 Z% Aactualwidth=ns_marquee.document.width5 ~+ a. ]3 n# g, ?1 A' Q* g
}
7 b% O8 v8 r+ ~$ A" L" Zlefttime=setInterval("scrollmarquee()",20)
, H* n, a; u9 ^% @( u# M7 m5 Q# A) ]}9 K" o! e& x( W' W( x
window.onload=populate
, @7 N5 q% Q. t6 u5 j
- {( B; b  S* r8 Tfunction scrollmarquee(){8 |( L. q# E) e2 ?9 o* i8 [
if (iedom){( E7 n/ ^9 l1 [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% T2 y1 p4 d# o3 G; x5 j9 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! p7 a- Q2 j& S& h* u2 e
else
. z1 _" P& S9 n  ~cross_marquee.style.left=marqueewidth+8
( N% F8 B7 M) o9 D9 ^5 I7 D+ C. q7 ]: y
}
7 B' y' P* j) ~else if (document.layers){
( o) x3 F* F) N' vif (ns_marquee.left>(actualwidth*(-1)+8))
" m. H4 e. ~2 p! \ns_marquee.left-=copyspeed
  ?( M" O% a2 v6 Oelse
; W6 I% r- G6 M+ xns_marquee.left=marqueewidth+8
5 T0 I+ Y5 Y3 z1 {0 o& y# H7 Z( J}
8 b9 ]  G* B! D4 ?}5 F2 L, |! q0 s

' v: F3 u1 f6 L- w9 v0 ~if (iedom||document.layers){, R! |( s( {8 C% y* T
with (document){. W1 X( c" \  F, D$ X% S* ^' T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, l. _7 V: V1 r8 e# dif (iedom){
( L& o. [! z2 S; A1 gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& m8 V5 A6 o$ Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 \; o- u8 z! T/ |  n4 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( N( W+ w8 i6 S. y4 J& ~" zwrite('</div>')2 J9 }1 m+ H0 b! O( z6 N+ T1 k+ y
}2 C2 |* C+ y0 \2 p- s* [
else if (document.layers){
4 D- g; G. W& B$ z# c% Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- Y* K% {$ m/ a! S9 b1 H! {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), x7 g  Q$ S* W- L7 n3 B5 R
write('</ilayer>')
$ q( k' H- k$ K" g6 r0 Y) K# H1 b* \}
8 v% {6 I* ^! H# E2 Z  \+ Pdocument.write('</td></table>')# G: l- x' q& h# x# c  G
}
9 R& R) Z8 k* H7 `}0 l" l8 w8 T0 A8 N" Q
</script>

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