返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. e" F9 J- S9 ^1 k. Evar marqueewidth=300" r6 W3 j6 U# m$ F$ }' H
//高度9 r2 D: f, q* u
var marqueeheight=250 G' w& N! X# ~0 x) Z! `
//速度(1-10)* s6 R; H: [0 n5 e5 A" P5 D
var marqueespeed=3! _1 C5 U1 A/ G2 o( i
//背景颜色
" ^% [+ V$ G% Q% Tvar marqueebgcolor="#FFFFFF"/ L$ @9 w( B- G9 k4 i8 x8 P
//是否能暂停 (0=no. 1=yes)?! A: {! [$ b' Y
var pauseit=1# Q; C6 }7 g" _6 y* e0 p

: Q3 }% L5 S1 T# Y//修改显示内容
1 A9 w5 b& s/ m+ {, h. D9 W" v$ Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ K* H& i5 K7 R% N& X& R% p

/ ]2 G0 C- N, c
3 B  A; s7 z3 z7 z* ~////下面不需改变////////////
9 X, j& I, B+ G- O" U8 o$ u6 H3 q6 h; y: R  T7 s
var copyspeed=marqueespeed
! I* ~$ H- _; b' W  Ivar pausespeed=(pauseit==0)? copyspeed: 0
: \( l% J, H2 a4 h4 n) svar iedom=document.all||document.getElementById1 |0 Y& ^( Y5 [
if (iedom)$ X1 g2 M; J2 F5 T  \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ G( R# l0 h: m3 G2 a1 Ivar actualwidth=''
2 i+ ^! z7 `; @* {; T( [' Evar cross_marquee, ns_marquee% g" t) M% n4 t. D
% o* z8 N/ ?8 U# H7 \
function populate(){
0 b: C) o" i! x0 u2 f# eif (iedom){
" c6 O7 X7 }! b% _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 m" A4 W! E$ k2 i1 t) Q5 {& N
cross_marquee.style.left=marqueewidth+8
0 ?& K7 e" C- g+ `' Bcross_marquee.innerHTML=marqueecontent
" z; F  f* F7 d! _' x' Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. Q5 ?1 A+ A: \- L, _$ L3 ~3 m) T
}5 [( ]4 [2 f+ V
else if (document.layers){
. x, S  @0 p, ?) x; Hns_marquee=document.ns_marquee.document.ns_marquee2
: ^& k5 P$ ^3 Q! Dns_marquee.left=marqueewidth+8" }* V4 _6 q: L/ m9 X7 t! U
ns_marquee.document.write(marqueecontent): c) ^, l' a: R; M: z6 Q( |
ns_marquee.document.close()9 [& T" E  K$ e  l8 G( _
actualwidth=ns_marquee.document.width! a  l' _0 p  X8 N" ^8 G4 K: w( m
}1 t9 C. N6 N: F* E0 ]. {, n
lefttime=setInterval("scrollmarquee()",20)
" B% p" V7 |! s% V}
) f+ |! S* |8 B' ?: Q# |& q/ Xwindow.onload=populate& |' T0 e5 Z1 Y7 X- E: p( P8 g% n
" @3 x# D$ F1 d4 p3 p. }# A
function scrollmarquee(){
2 F: M& }2 g1 p: w3 x+ mif (iedom){
5 i% |! ]- ?8 l: J$ R+ Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( [& M+ ?' U% C7 K6 ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" R/ Q; |% B- s/ ?else0 U8 N! I) ^: q8 Z/ Y& O' G2 @
cross_marquee.style.left=marqueewidth+8
9 T8 |6 a" i5 o( N& l$ j8 z8 I5 k* \7 {" ?$ R$ x0 n: [8 h) x
}3 a* m# Q" Z1 e1 r) M, P
else if (document.layers){- R2 C) c1 M! c! A7 o* K
if (ns_marquee.left>(actualwidth*(-1)+8)), D* a# U/ e. R6 c
ns_marquee.left-=copyspeed- l4 I( k' a6 D' G# e
else
! @( g: }8 ]/ h0 }2 @" ?ns_marquee.left=marqueewidth+84 y1 r2 R; {& C5 i$ U& ^  Z
}
  J. Y, V, m( D: q1 p( z$ J7 ^}2 c+ H: e- i' r. f- D
1 Z3 ^# F1 m. `& B! n. e
if (iedom||document.layers){. r% b3 |3 X6 j- R
with (document){
! S* e3 n6 z' y. V: U( hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- }/ M5 ?! Y5 w: h
if (iedom){$ @1 y, ]2 C1 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ j$ B3 w& [2 l) o/ x: `( d3 m, \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  H! Z& h5 H" z4 y0 u. Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- K- S. h* Q- B1 M  g% Z
write('</div>')3 k5 d2 e, [, e3 A
}5 r3 `% W4 {& K+ l* l: a0 v, `
else if (document.layers){: a! w- l6 h  E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- z0 H3 L7 |% @9 C6 L* E4 ^. x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 g+ Z. m8 ^& Jwrite('</ilayer>')
7 p- [- S1 H6 ~! K$ r}
$ y, G! ~: Q* e6 ?3 F1 u6 F; edocument.write('</td></table>')
& W0 _2 [0 O  \; Z$ j  E7 @}4 O% B% \. c6 W
}
& b( E+ d% a! W1 K* Z% E  v3 _! f2 _</script>

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