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

|
网页之跑马灯文字特效
//修改宽度
' N" ~- f7 c7 f# _var marqueewidth=300/ ]% c1 H. ~& q2 X6 i, X( M5 ?
//高度4 L* d5 y$ t. j$ ~. C, Z
var marqueeheight=25) m! e6 [2 G& V% A- u: ^3 R
//速度(1-10)
& a2 r Q5 H: d& ? e. \: bvar marqueespeed=3
' L8 P3 }8 x3 z//背景颜色
# Q! {3 T# I+ v" hvar marqueebgcolor="#FFFFFF"1 P7 r: w4 X. |
//是否能暂停 (0=no. 1=yes)?
# V/ i" R7 N- m1 n# ^' m% `. @var pauseit=1
1 F' t1 s& d$ x% E( b5 w2 E
/ Q7 O' f! v5 |$ B6 ^//修改显示内容
; {% L; z R; B: H' f- O9 t* z: X0 Svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', _$ u$ B: u/ R( M) [
3 M* L; a) [! {1 f1 K
+ e% p+ X3 L% J
////下面不需改变////////////
* F, N' u5 J+ R0 B$ g9 ~' p1 O) ~8 j" b8 Q
var copyspeed=marqueespeed1 y5 P1 O! \! ]$ M: l' t
var pausespeed=(pauseit==0)? copyspeed: 0; f1 A) z% k. z) w/ J
var iedom=document.all||document.getElementById( b2 p; l4 Y5 n
if (iedom). l: T/ r' } N% W1 H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 H7 r. m" v2 k6 ^, k
var actualwidth=''$ }. R& j! s4 n2 B9 m
var cross_marquee, ns_marquee) e+ ?0 h" ]* D: `2 m
0 j2 o. X- z3 [( c8 a! t3 l" t
function populate(){3 |6 \ ^8 |$ L3 v% e% G
if (iedom){
. Y: R9 \, b( {" p, R% R7 }& X$ o$ w' Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 Y& D9 i( l ^' a ?
cross_marquee.style.left=marqueewidth+8 T. y, `4 w" r* q+ `" X, C! C
cross_marquee.innerHTML=marqueecontent- }- t2 g0 }" `, Q! ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 S# X0 @4 k4 A4 z+ W5 b. j: Y5 ]}
! G- F, }2 z" \3 u% R& Pelse if (document.layers){9 _6 [$ h+ H `% E/ i& R
ns_marquee=document.ns_marquee.document.ns_marquee2' ^9 D- T x, Z3 w( g# y
ns_marquee.left=marqueewidth+8
, y$ h n" O3 A% {9 v; ins_marquee.document.write(marqueecontent), \$ S3 Y$ S4 V
ns_marquee.document.close()
3 @ ]) H- ?( F- r& U2 z7 [actualwidth=ns_marquee.document.width
- i# Q( N8 |% Z1 S7 b}
0 h2 y; p- g) k" Flefttime=setInterval("scrollmarquee()",20)0 r- {: {7 B5 z2 t8 F/ v
}
, ]5 g" f. l$ j1 `1 c6 Ywindow.onload=populate
4 I$ h- M9 y4 h
0 F8 w" i3 q. S9 L1 Z/ l) ~, I4 I' |function scrollmarquee(){7 F% P: @: c E2 v3 r$ g
if (iedom){; A1 R( @7 l! b+ l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 C, \7 b! {/ B1 B- M& ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) l5 E) G8 }) m$ a
else
& K F3 d+ K2 G5 G! a; s5 |0 _cross_marquee.style.left=marqueewidth+8; i+ S0 u- j7 f0 h! P
# q' M6 [) W6 t; }$ U
} A" e: W' Z5 M$ W7 p
else if (document.layers){
4 y9 Z& h. {# z) |1 eif (ns_marquee.left>(actualwidth*(-1)+8))* P j$ o5 e4 Q+ ^
ns_marquee.left-=copyspeed1 J- x- s" e* x& n d4 A
else
1 V) J% K7 X* jns_marquee.left=marqueewidth+8
5 V7 ~8 r1 m4 E: V}
6 n& W4 R: G- w. } b}
3 r7 h' H+ L/ |# ~! ?, \- x2 _5 R. D
if (iedom||document.layers){
6 D: `6 j' o- w8 E) ?0 uwith (document){
8 P z; I5 O0 `' }+ ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' F3 ]: T1 H. b
if (iedom){
# T6 e6 A3 U( V- B" } h& J' K# Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- O" ^) r$ J* b$ C$ d twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) n9 }) X" R: ^+ [9 \; d: ?, B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% L" g' y. l" K, Y+ Z5 x# V9 owrite('</div>') Y/ T7 h1 r; i' R9 d" x
}
8 D# \$ P4 l D7 X1 x4 }else if (document.layers){8 ?' Z+ a6 V& R5 g9 \& C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 `7 r& [3 L% z" n8 k) R- l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! i/ t9 l" j$ ]( E4 Iwrite('</ilayer>')
+ b0 |+ ~' Z9 e1 Z}
' U' ]- z! J7 X1 O6 v0 Z! i2 `document.write('</td></table>')
6 U; ^5 p/ S9 C8 Z) ?}' i+ d1 @' J: ~' o% |% w
}
8 [! R. Y9 A1 P/ y* Z+ i4 W t; M</script> |
|