返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* [( m! s9 G4 L" t$ a9 H* Tvar marqueewidth=300
% w  h1 R6 x- I) g" @" e6 U//高度
: W( n0 c/ _0 vvar marqueeheight=25
2 C; y5 z8 ?( b; }& W//速度(1-10)
, A3 z# f0 C/ @3 b! e& @var marqueespeed=3
9 A4 w/ N, m; o3 b//背景颜色
! A  K/ e& D# S+ N  U9 qvar marqueebgcolor="#FFFFFF"' N. B, T& P( b, e
//是否能暂停 (0=no. 1=yes)?' ^8 V( _. u9 \2 {% X* I' D/ c
var pauseit=16 }% `/ W7 V& j; f; Z& d& A
& ^9 G! g, i. `: `3 ?/ J' {
//修改显示内容. D+ y* n. N7 J! a+ |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- t4 A6 a- w! h+ Z) F. ^$ \) H! R" P( J. O+ K1 ]
+ q3 t3 S" d; H
////下面不需改变////////////1 x& N7 t5 t/ B6 }) i% z

  M1 p1 K, h$ }, _/ wvar copyspeed=marqueespeed
6 T- \" J- n1 A$ O7 o5 y- p  lvar pausespeed=(pauseit==0)? copyspeed: 0
: B% v7 t' |/ V- c- jvar iedom=document.all||document.getElementById/ Y4 g- k- Z7 C5 M
if (iedom)
, x0 O7 [0 _4 _$ y! V; v- c4 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 E* r2 X4 @8 M0 E! tvar actualwidth=''0 H: d- w- q9 X* t& F
var cross_marquee, ns_marquee
" X2 ^- ^6 D- c  \2 B: U+ r* _6 h1 T: O5 c% x4 ]
function populate(){& a* T* _" ^- G  D$ |% Y# V' k. M
if (iedom){/ T/ f) O2 g  w. ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: ]" v4 y+ ^2 \1 D0 Lcross_marquee.style.left=marqueewidth+8
0 n7 Q' d. Z6 I" i5 ]; z# `) `cross_marquee.innerHTML=marqueecontent
" `4 L5 p+ K  [9 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. T0 q( Q& |. u5 E/ S}
) H" w& _: `8 n. m+ s1 z9 L) ^else if (document.layers){6 K7 x9 p# d7 M! {5 ^
ns_marquee=document.ns_marquee.document.ns_marquee2" q, {; u, X1 C3 H( ~3 i% K6 V
ns_marquee.left=marqueewidth+88 u  H' Z3 F  V5 l" R  U! H- F
ns_marquee.document.write(marqueecontent)
$ ^* z" G/ F5 T! C6 q) \ns_marquee.document.close(): D7 p( a& l8 Y6 p/ u0 O5 B4 r+ [
actualwidth=ns_marquee.document.width8 Z9 j) a6 \' f; q! u
}
! a4 `& x& x) B; G$ A- b4 F2 }lefttime=setInterval("scrollmarquee()",20)
, ?7 o& U& [! x/ K1 Y, t}! I7 x: u4 j2 q9 c
window.onload=populate3 P! T  r, A4 t( s* l
% l8 M0 F! Q3 J# m# G9 i; l
function scrollmarquee(){/ P8 w$ X0 F: ^  r4 U4 T+ P* g
if (iedom){
9 y. g$ z- ^$ H! }6 j( J# \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" _# |$ X+ e5 c6 b; f; ?; ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* F0 _6 Z2 v- q0 h1 U7 P1 @else
: T' t0 \6 M% L+ o% c( Ccross_marquee.style.left=marqueewidth+8
+ z9 J5 F% x5 Q) B. ~( O) [- l0 ?
; ~; ~* l3 @5 y" E( F}" K0 F  T+ j! P: [8 n
else if (document.layers){$ h3 _4 @' N* {" t7 O& {1 \( K. {
if (ns_marquee.left>(actualwidth*(-1)+8))& ~1 g5 G6 K. [
ns_marquee.left-=copyspeed. H3 |- _- r. F
else
7 w- G# q0 m/ B# T  O3 o& mns_marquee.left=marqueewidth+8
& f7 @6 `2 I0 M: n5 X}* W$ r  R# x; d* u
}
- s1 @4 h. h- M3 y  V! f* [: ]
4 L; f% M, `3 S  x. N) eif (iedom||document.layers){" K: W! Z. u) y$ o3 K" b
with (document){
9 f" w; t" w2 P! Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ R) d0 w5 i* b6 G5 e  c
if (iedom){  `" A7 X2 O2 V& H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) O+ K; o/ w# j* j6 Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" `# b. T) D+ z+ r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# {3 G# q4 v' ~8 P5 L) d
write('</div>')
2 d7 [! f9 ]  {}- P: a. j: t/ @. N
else if (document.layers){8 H7 P. o/ }7 b+ L. D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ r0 `5 U. g! ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( `0 d  @7 O. Q# L# K
write('</ilayer>')
1 Q3 C% S% D6 Z8 O( g- v}
* m6 `6 p' n( B$ _' J% x$ v( z( qdocument.write('</td></table>')0 N3 V( G' j% l9 J& z3 M: j
}
' l* Y1 r7 N' F}3 i) n! ?7 f9 n" b4 x* Y6 a# |
</script>

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