返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ S7 g; y$ n. G* A# ]
var marqueewidth=300! a2 U! A! b! H
//高度* c% g1 {- h1 c+ F
var marqueeheight=25
% M" G4 e5 E% R//速度(1-10)
, V- R) |( j3 |& X1 d% ]4 u1 dvar marqueespeed=3
9 b) \$ ?) s8 W$ H) S, ^//背景颜色1 M% k; |; a/ e* P9 ^
var marqueebgcolor="#FFFFFF"
- W- e7 w! I; b2 _3 W( g$ X//是否能暂停 (0=no. 1=yes)?
% y1 {  P+ w, w" N# xvar pauseit=10 a# J) O0 x- t" C

# @1 t8 r. e1 V2 T$ g5 N' V; V2 P//修改显示内容( ?. o0 a6 }8 q/ ]! S0 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# _0 N: l" f( n) c1 R2 |% ^5 ^! t

% G8 D" C& D- Y  \0 T& M" Q4 `+ Y* o% R" ?: o5 `( Z; Y
////下面不需改变////////////
# M  H- S8 P# Z* j" Y- ^
2 o. M8 d3 m+ l; a/ p. Q7 u* u2 ?var copyspeed=marqueespeed
2 w$ P1 m' u3 g2 ^var pausespeed=(pauseit==0)? copyspeed: 0
4 Q9 ?  U" f. {% E1 m3 Wvar iedom=document.all||document.getElementById) y; w( L& @' g
if (iedom)
: x1 @4 W  {1 C* b5 R6 Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; B& T0 a& L) |5 K1 r7 V9 Z+ [var actualwidth=''
5 k& Z9 n( W5 [2 z$ i7 Kvar cross_marquee, ns_marquee
" X7 G  S( {! }6 L/ m1 ?* Z: d) n
function populate(){/ A6 L, W0 ^4 q
if (iedom){
" ]0 F. F1 P8 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 }& [3 Y0 E: {
cross_marquee.style.left=marqueewidth+8
1 Z; O+ X: U8 d8 ^' n; {" k- lcross_marquee.innerHTML=marqueecontent+ z$ ?4 c3 F+ f" S' A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" r8 a$ K1 Q4 A7 F8 G}1 z! R# K- Y; l. P* }
else if (document.layers){2 M5 W6 v5 p& J; c$ T' ]4 n
ns_marquee=document.ns_marquee.document.ns_marquee2
% G* y! a5 e8 _# ?( mns_marquee.left=marqueewidth+8
2 _9 p0 U$ I, I/ sns_marquee.document.write(marqueecontent)
4 M$ ]$ ^; l8 `" Tns_marquee.document.close(). W2 }$ x+ x9 }& {, x# O
actualwidth=ns_marquee.document.width- u/ o& i2 Y. K  t/ q, |) ^/ ]2 d
}2 x5 [6 T+ }- n5 S+ J  S: G
lefttime=setInterval("scrollmarquee()",20)) d& C0 x; s$ L8 |
}
. @) G# g5 ^8 s& c* p* cwindow.onload=populate8 C+ N/ S2 H" r8 n, `
2 M( b. P; r, y  [, a
function scrollmarquee(){. _9 F- ^3 d, |& T( }7 r
if (iedom){, f# N, L0 m3 n& d, G' K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& P: a/ _: \. q& n- _5 R( o( ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& U; r/ M2 Y5 i& f% p5 ]else
1 ?3 a, e4 V2 d" dcross_marquee.style.left=marqueewidth+84 T6 D4 o2 E1 |* l3 Z6 L
! [& S- `: ]# P$ r3 C
}5 o& W, H$ \& Q# F7 v5 i$ r
else if (document.layers){- a# H% A* A7 T) T1 E
if (ns_marquee.left>(actualwidth*(-1)+8))
7 |0 z! D9 ^5 v) Qns_marquee.left-=copyspeed1 I7 |3 x& r# ^5 A
else
- j/ @2 ^" U$ {. O  \. Q- uns_marquee.left=marqueewidth+88 c2 C3 G* T- s" x2 r/ U2 j
}) O* r5 c6 {9 H) q8 n! G' `& w) C- b
}
2 ]. V/ I3 X& X- K4 a! c
; E& }! y, l  ]6 G, M6 K6 Oif (iedom||document.layers){% \7 y2 a! {) F" A
with (document){+ t: V6 E( c4 i* A1 g/ M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 f% S% i. R1 H; Z+ @: g! Z* @
if (iedom){+ X8 V( f* c6 @# G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 {: L/ f) Z8 r5 Z) Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* m3 n+ y0 D- b8 X, o! L5 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% W) I0 A4 d: p# e( _1 n
write('</div>')0 t( p* Z+ q+ x0 `. ]
}7 }8 \: A* |" ]& `' A+ [6 Y
else if (document.layers){  ^9 m1 `4 d" G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), B9 j" ?: x( K' k' B: {3 z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- d" H% S6 W7 K/ B. H6 v) }  ]
write('</ilayer>')' X# e5 s/ }9 \$ V2 n: @7 K8 G/ U
}7 [+ U' I/ l2 x6 s0 K
document.write('</td></table>')
$ S5 z7 m, v( X5 T, S8 \9 z}. T, ]9 r5 W% \- g' d- }
}
0 r9 v" H9 U; D+ c2 x</script>

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