返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 [8 u! Z# s/ ^5 B$ w: ?
var marqueewidth=300
" |" q  h$ e( \! D, G, D//高度/ o1 O7 y8 L/ w1 M
var marqueeheight=255 ?, i% R7 k% V/ ]3 c
//速度(1-10)! H! e* g1 N6 V; {- u
var marqueespeed=32 {: B3 ^: }% C) R' f/ U
//背景颜色
& k$ v4 ?4 P9 J. Y7 N) K3 T  {var marqueebgcolor="#FFFFFF"
: i! B% F# d5 q7 b- B//是否能暂停 (0=no. 1=yes)?4 K# L5 |9 U. N
var pauseit=1
% v# |: L" l4 V- w0 S- s, G" W3 I% `7 o5 e" a/ a7 b! Z  y; h
//修改显示内容( l7 B+ v. c6 {9 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': E# C% j1 O! R$ h0 e

, i% w! N+ @. x4 s- W9 _0 ?1 V3 m3 L$ _6 Z" P% E
////下面不需改变////////////
7 `/ r' k6 e6 W- t: X4 ]- w- ^
  I+ [5 z7 Z4 p* [/ y4 rvar copyspeed=marqueespeed
6 j9 {6 N1 ^- |0 S7 J2 }7 n! dvar pausespeed=(pauseit==0)? copyspeed: 0& p% y2 Y7 ^' p
var iedom=document.all||document.getElementById
) N( R$ W6 J  z' U9 r* o) J! E' pif (iedom)2 [( @' K5 X8 c7 g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! q- A7 v5 r$ r# t: }- h5 I
var actualwidth=''
7 M. {! }  X. I/ p. ~! Zvar cross_marquee, ns_marquee. P1 o9 G; ?% G$ Q: A0 N0 f- r
% C7 @/ ^, B7 `' S( @1 p' L
function populate(){- `( O$ q( B/ u0 B; h, {2 R
if (iedom){
! F9 Z, ~+ b& {1 a  O& s1 k! icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' k5 K  U/ T  r- H  |8 W9 Z0 q/ Scross_marquee.style.left=marqueewidth+8
4 m* w; M" }& y3 f) Dcross_marquee.innerHTML=marqueecontent
$ ?$ D5 R. d1 ?" l0 M7 e; Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" o4 l) p5 }4 R4 q6 r
}- Y: x$ d$ ^  L/ P  A/ X1 q: {
else if (document.layers){0 U* x4 [$ i( L' K& t* y/ ?1 X
ns_marquee=document.ns_marquee.document.ns_marquee2
2 u$ G" f$ }2 A1 yns_marquee.left=marqueewidth+8! n$ `$ ?/ B+ l2 L* g
ns_marquee.document.write(marqueecontent)
3 }  @& P6 e0 E2 L) q. Pns_marquee.document.close()
5 q( g6 Z5 B6 E9 C0 ]  @actualwidth=ns_marquee.document.width
0 e4 ?/ ]' w: B: |" N}
/ C+ W# `/ O% A. g# H' Qlefttime=setInterval("scrollmarquee()",20)0 |' ]3 T. [& s! P1 y' I8 D
}
" H( ^  X0 t$ l0 ~: e3 K% l6 Jwindow.onload=populate
4 T; K& Q) x0 d2 m$ T2 @$ t6 |; Q) o9 Q+ A# m( p$ \
function scrollmarquee(){. i: t4 O% s5 Q0 F* x2 Z
if (iedom){3 u8 V+ }' R3 m; a/ L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 M( U! |8 P6 p0 Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* E* \, Z6 Q, A; ]else8 j9 R6 G8 `: f; l
cross_marquee.style.left=marqueewidth+8
) Q! `' K; \1 L3 o* n' c; I* D
$ G& w1 \. Z9 o% A}
7 q2 B; J$ ?' T& r  w0 \else if (document.layers){
& ~5 y4 d: z) z& ^& Wif (ns_marquee.left>(actualwidth*(-1)+8))
8 }& m# c1 s: q( V  `ns_marquee.left-=copyspeed; |" _) C# e3 i. F( Q* U" Z. i( D
else
% Z) y/ \3 c" p% q% [, B- W4 sns_marquee.left=marqueewidth+88 e0 z3 q! Z( ]
}
, V8 z9 S; U$ ~) u0 R9 t3 H& i}
/ ?4 r, j: D# f
5 O& L" Q9 }6 M' P0 }if (iedom||document.layers){
: d7 t/ L8 C2 z" G+ Mwith (document){1 w3 T& k/ ?% Q  M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 Z& g6 c4 A+ {% U$ j4 r/ Qif (iedom){/ v; @+ ^+ ?6 K. Z* J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" V# |( R: q! \. m* @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& t8 P/ z' e3 [0 c& e6 }5 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 ~! c" }( M. V  e1 ~4 V
write('</div>')0 ~& K. X. B' g( _, R# c6 R
}1 Z; T8 i4 y3 {8 E5 J) `5 A
else if (document.layers){) d; J* i, V/ S: q9 ]+ ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); |6 r9 H. e* z7 ]) Y  J8 N& D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& u' j& |/ J1 ?; d
write('</ilayer>')
" t: O: M; q" l: S  P" o}
+ L7 B4 S7 o6 c5 J6 xdocument.write('</td></table>')$ K, z% C3 G0 P7 e
}- {9 _4 u- s, y+ w/ X
}
4 X+ d4 ^  U5 b$ W7 [+ O  }</script>

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