|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度! m. L9 T9 }$ d7 F8 f
var marqueewidth=300
5 E) w$ N: B- e- D/ Q9 L//高度0 K$ F* s: w' F5 n# x
var marqueeheight=253 v- C x# R5 V- T
//速度(1-10)
. T. [8 p( L$ _' ]var marqueespeed=3
& H0 G! o2 P1 h+ Q' a6 g- }% x//背景颜色
! r* D/ z. P9 e7 f4 q# _4 k. evar marqueebgcolor="#FFFFFF"
* C9 b, o2 M8 c- i: I' n. q//是否能暂停 (0=no. 1=yes)?
& _/ v* n- A- ~. e7 I2 T, ivar pauseit=1& l. k" n% B* _ T" h" v
4 ?) f. ^6 c! {1 Y, D! O
//修改显示内容; H- M* X7 N! k5 C/ |) G' Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 x- ]) r' P$ @/ J6 Q- x
% G6 k1 ^4 ?8 C# b5 K2 x& O# {6 [' e. l/ ]7 x l: l
////下面不需改变////////////; h+ n4 s7 u( s2 i' \" \
# P1 s/ r3 _( C$ F# M/ v* C2 o) u+ ^
var copyspeed=marqueespeed7 Q! j0 ~5 I+ X- V+ V2 O) y) p. N
var pausespeed=(pauseit==0)? copyspeed: 0! A8 l4 u; X# h9 g
var iedom=document.all||document.getElementById4 V! e9 O. O2 L) @2 t( ^) _4 V$ N
if (iedom)- A6 b. U# S3 D; P# N5 d& i: a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- T T- Y, o; a$ u8 Vvar actualwidth=''
- v+ W3 }4 a+ ?var cross_marquee, ns_marquee9 H( Q5 G& k$ B8 b
, X0 S7 e* n9 K4 n! A
function populate(){8 C1 v6 W4 \1 u" I
if (iedom){
5 r! Z* a; m& d! `8 J4 jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 Q0 U+ E; {4 \
cross_marquee.style.left=marqueewidth+8
( I3 h/ a& X3 `; pcross_marquee.innerHTML=marqueecontent u8 |; q6 |! V6 R9 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 n& l# o( \' P: W
}
- e% p0 R% V( ~, y! p% jelse if (document.layers){& h% P0 D. ?: L1 }& K* G) |2 z
ns_marquee=document.ns_marquee.document.ns_marquee2
f' E+ }2 u$ b9 N, kns_marquee.left=marqueewidth+8
9 W( K- o$ N- ?) s( f4 ^ns_marquee.document.write(marqueecontent)& C# D0 [: Y; D" Y
ns_marquee.document.close()0 b: `+ Y! l" Y. Z. s
actualwidth=ns_marquee.document.width
6 f, `# s$ y$ ~8 E( C) \}% d8 n7 q% l- |% T! \ n7 U( a
lefttime=setInterval("scrollmarquee()",20)
# D0 z/ k/ M4 U; ?! V( J}5 v& h }5 }4 {# R5 ?' b( c
window.onload=populate2 ^7 r, f' n+ ]
% t$ |5 } y* G7 c4 Qfunction scrollmarquee(){; N8 t+ @: \! g7 s3 _2 E- O8 h0 [
if (iedom){
; H; c! n- F( O5 o/ _7 v0 S7 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! J/ ]6 @8 r' K8 ^5 ~ A* ~6 ?: r2 C5 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: A# l' O% O2 ?+ oelse
9 U( E( Y& }4 w( @; U; M% ucross_marquee.style.left=marqueewidth+8
8 X* G5 R) \+ @% ]* {
/ o. l5 Z3 E9 i0 w4 u}* ]% l3 x6 M8 P3 V; R
else if (document.layers){( q; S6 Q0 K }* j& ^+ D1 q
if (ns_marquee.left>(actualwidth*(-1)+8))+ L2 y5 m0 I+ q$ F3 [+ I
ns_marquee.left-=copyspeed1 d" O6 E0 j- r6 B. i& L2 E
else- F$ B# @: X& m' o
ns_marquee.left=marqueewidth+8# D0 @% e1 ^+ z* Q' d
}9 {( q$ r g5 q
}
n2 n- Z3 g* C3 @3 D4 d/ P& K& m) x) r1 G! J* J
if (iedom||document.layers){
2 V! P+ c% w5 r! I6 \with (document){4 o2 }% [$ ?! Y& _1 u8 r, z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* M' T0 f7 d7 `0 H7 e) |1 T
if (iedom){
/ K2 w0 q* ^5 E+ J& C Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( y, g( d1 S" b' h" d9 Y3 o! p4 g0 W0 `- Nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): G- B7 X4 W H9 `% _ L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. ]: o! I3 u4 F8 u) A0 ewrite('</div>')
: Q2 J" m; `; i' n% |! ]( V}6 i D, x/ c8 ]
else if (document.layers){3 {' ]) p* w- r! h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& h1 c9 }0 b' w1 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% F% v& ~, e; L! G! ~+ S
write('</ilayer>')$ D) t2 t4 F" m
}7 d' \" L4 ], r+ h) B1 ?5 ]
document.write('</td></table>')$ U3 f) |) ]8 X# Y
}/ E1 X, u8 x4 T
}
: @' b. P/ a8 g9 m1 U* e</script> |
|