返回列表 发帖

网页之跑马灯文字特效

//修改宽度% E; ~/ h* _, w# j6 A  q" ~- e
var marqueewidth=300
; \& I% f; ~! ]# F4 q//高度" C% B" }+ M3 `* J% [  ^5 [, T; f
var marqueeheight=25, s9 [% z# F  X8 b* M' C
//速度(1-10)7 k/ p7 a- u! S, c6 |1 `0 {
var marqueespeed=3
2 f0 x/ A. q( u& M$ n//背景颜色
# c- s" y& o5 d" L. Bvar marqueebgcolor="#FFFFFF". J( A& ~; ?- E4 y4 @. S- n5 W
//是否能暂停 (0=no. 1=yes)?
5 E4 f! q$ R) x( B# j7 R* d: Mvar pauseit=1
5 b, S0 s8 {9 z& w/ z6 z; b9 L  r: S7 M- v2 z+ \: x
//修改显示内容; F& F. U9 m# P( B+ g/ y/ Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. F1 y) i1 J! R, t5 G: n; i! v( ~( ]$ S: C

- M  ]. m) n. F, T5 g' ?////下面不需改变////////////2 B2 X+ {. J" [& q9 m
5 f" S* o  C2 }. x
var copyspeed=marqueespeed/ G5 O" G( W, i0 m. \
var pausespeed=(pauseit==0)? copyspeed: 0, X1 W+ _7 Y" ~. Q
var iedom=document.all||document.getElementById
& y! w% V9 S1 j6 Kif (iedom)+ u2 i$ p8 I. p# U% T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ v# O8 H0 k/ P
var actualwidth=''
% ^" X* Y3 ?( @( Uvar cross_marquee, ns_marquee5 }8 ~7 o1 g5 b, L

1 a0 p- n( |! A) S& xfunction populate(){) i# u& l% y  L6 q( i: C$ {& y
if (iedom){) a- L* L3 D  r0 H6 t3 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, U( K4 ?8 j, b, I) i# I& f& m4 b. bcross_marquee.style.left=marqueewidth+8
: ~( y: u: `) Z! {+ ncross_marquee.innerHTML=marqueecontent0 o$ E# ~) y8 ]% l3 B) A9 c* X* p3 N! d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: `, P& V# i4 m! O4 b8 K" H}+ B. c3 k$ W+ u9 n
else if (document.layers){
: Z$ a. o4 Q$ n7 {ns_marquee=document.ns_marquee.document.ns_marquee23 a( @3 o% Z# h
ns_marquee.left=marqueewidth+87 h. D6 k7 }9 E
ns_marquee.document.write(marqueecontent)( J. f/ p# X- a& C2 W
ns_marquee.document.close()
8 ~. u* H5 \) O, o1 Kactualwidth=ns_marquee.document.width
4 _3 |& S/ t9 D}: q3 g" o& F' a5 _
lefttime=setInterval("scrollmarquee()",20)( m/ |5 a1 F& @5 U% u2 u
}
8 ^/ q) v* R; W1 W' [0 p% `6 L2 C8 ~window.onload=populate$ k3 t& i, {( D. y% Q
2 n% a) D9 I* u3 W, M, z0 ]9 g  _$ y- q
function scrollmarquee(){
! v% C. U0 h  e4 z) qif (iedom){
' y  d- v# }1 }: n* aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 [- H; i# g) D3 w( @' k3 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' g- c4 q8 E# w
else
# }6 N0 y4 s2 f/ Z& p( Xcross_marquee.style.left=marqueewidth+8& c% j% c. [2 y, x* b5 r
5 k: z4 P/ u- p3 D
}$ u$ e  T2 k' n  Y5 C% `0 I9 m
else if (document.layers){, z& ^' ^# O  M. o
if (ns_marquee.left>(actualwidth*(-1)+8))
+ D$ x# m0 v+ X$ S- |- l+ yns_marquee.left-=copyspeed
: v/ h  v/ u0 Celse
1 U. u* u6 `7 c: xns_marquee.left=marqueewidth+8
. |, Z6 x7 K" E/ f+ @+ f}
5 U; y* f1 N( X* z8 y, [}$ F! M& v$ `, d6 o$ P
+ E; g- N  b4 g" k
if (iedom||document.layers){
. [" w2 g3 t0 _( dwith (document){
. V' S# M6 C& sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" O4 E8 K& \6 y8 C& T8 Y5 {  Nif (iedom){: R6 Q) @. i/ L/ p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% \( L" w$ ^1 e) v* B+ ^$ w* {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# `) c* {1 y; H0 t- T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& P6 ]  p0 f9 o( E+ F9 Y3 k' \9 [write('</div>')
2 H' f! |! A1 n6 h: k}: O, w! Z2 P  B$ j
else if (document.layers){) C! d3 t1 l( w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# e: ~* I9 i, ^% A5 e* _3 |( Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ f8 ^. e  J* Y/ Y" l  ^' \7 P  J
write('</ilayer>')1 P+ ~% T6 L* ?# \/ f& W( v/ ]
}
; Z& g+ H% r2 R1 |( kdocument.write('</td></table>')
* e# ?, z# S. c6 O  m4 I}
6 I+ R1 N8 g0 c- i4 t}3 \7 Z: f, b( c( U2 g# V
</script>

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