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

|
网页之跑马灯文字特效
//修改宽度5 p$ I2 P& k) _7 |! f U2 t- c
var marqueewidth=300
) @% { U+ i/ R5 g: ]: ?, V) Q8 A2 k//高度
% L9 r6 R+ f; |0 v7 E; q& Q4 r; pvar marqueeheight=250 ^* Y6 q. U7 }* w& f6 f& e: J
//速度(1-10)+ U2 K2 U$ g7 O9 L+ y/ T# c4 k
var marqueespeed=3: s: q8 O( `) s* u2 x
//背景颜色( ?" L5 E# X4 M# ?
var marqueebgcolor="#FFFFFF"
; U4 p$ d$ e7 w6 F* P6 [' i" B//是否能暂停 (0=no. 1=yes)?5 O2 |, z0 Y! Q$ w/ t4 ^0 i+ p
var pauseit=15 D( Z% f" a) W1 G& f
; P5 M& f% n E$ o; R4 C
//修改显示内容
1 J! c- L/ S) h- @7 J2 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! G4 J3 p) W- D4 I$ g5 i
: m1 t3 O1 O# q# ~9 ?% Z0 h, E
5 s( p3 e; [9 h k- J7 v////下面不需改变////////////1 f9 e3 S- F9 c( z
3 p' z! y2 m: I: A4 Dvar copyspeed=marqueespeed9 \ b( @/ l( k+ Q" i* L! \7 u
var pausespeed=(pauseit==0)? copyspeed: 0
; Q \" E% N5 `var iedom=document.all||document.getElementById
# w7 j0 m+ m, v5 s$ qif (iedom)0 h9 _" G$ D+ t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 p+ ~; B1 e' o; {
var actualwidth=''" q' z: ]" w9 z& Y; H% f' V
var cross_marquee, ns_marquee
' V% u4 i; ~$ T! p, E( f9 G( n$ d$ B1 m
function populate(){
" A: J6 L) y8 i+ z' c& |4 r# y1 A1 mif (iedom){! W5 t5 f X" g6 U- {0 b5 _4 ~1 P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 m2 ?' W9 i2 ycross_marquee.style.left=marqueewidth+81 n* x4 M$ Q/ i' A) K8 {
cross_marquee.innerHTML=marqueecontent
, t9 C& _6 {' X8 R9 a r" bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 x+ z: r3 p) J}
; i3 d, Q, n. r8 V: V) Nelse if (document.layers){' n) @8 A4 A" P. W+ Q' m( x
ns_marquee=document.ns_marquee.document.ns_marquee2
- J$ |1 F g* N& M$ j$ d. L7 @ns_marquee.left=marqueewidth+8! R5 Z0 z: J9 k s
ns_marquee.document.write(marqueecontent)1 L! @/ x* y$ E; Z8 E+ m2 k
ns_marquee.document.close()# {0 G6 t4 b0 `( A. H
actualwidth=ns_marquee.document.width
& n2 q9 b5 _: }- }; M/ Z}
' s& G l2 S c* O6 O) \% X7 K! olefttime=setInterval("scrollmarquee()",20)
& ^; D. f% f5 P8 T}7 u" _+ S+ A, Q' N2 ?
window.onload=populate+ |9 E* I6 @" [4 X& C6 N$ U
1 Q8 z( x+ I% c: B( ffunction scrollmarquee(){5 H0 I8 V: x+ \; ?, ~2 p
if (iedom){
4 W9 U1 }! f3 z2 n7 Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# z- M. I2 j/ |! [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ m7 G4 X* R" p7 G. L7 {! F$ s$ Kelse. D' M5 c; V8 \( j4 L
cross_marquee.style.left=marqueewidth+8# v- w+ ~/ t" G6 ` a$ s
: q! |7 `+ T1 I+ m% `# M& D9 X5 }
}1 Q h/ `) R! T F$ _; \
else if (document.layers){' `% ?4 B, U! {2 g3 i8 x0 P7 h+ M
if (ns_marquee.left>(actualwidth*(-1)+8))1 U, J' f2 ^% a0 `3 B( P
ns_marquee.left-=copyspeed
5 I+ d M( O6 H4 \, ]3 q) delse; c8 m; T+ T, j k; o( H
ns_marquee.left=marqueewidth+8
- J( @2 V: U( R- @}( x4 d! ]; L7 P3 P# e
}
2 _" I2 r* R! D0 V2 s2 B
. D" y8 i( V$ R8 f) \" `7 V1 T eif (iedom||document.layers){
0 B. r3 ?2 n; K& Z5 hwith (document){7 W7 m$ H# G% B+ _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ ^7 v [9 ]" G e; N) `9 Q
if (iedom){& T4 B' n2 Y" C3 o$ \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 X2 n5 |& s$ t; t5 \8 Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 V, j) S6 e% I6 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# Y" |7 g! g$ i/ I" b Gwrite('</div>')8 C6 c- E, u6 x- g" c$ \; m* f
}
1 b* M' d+ J" U' o! Y# O3 delse if (document.layers){* _: J' S# h8 I- K) Q( b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 w! n( n2 ? `! Y% ]+ {4 c% d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' z" H& I6 K: w: P6 f& o9 f, R1 J
write('</ilayer>')5 b+ N7 Q. ?& K& |8 E8 b
}
( L* d) m( Z1 x- O* ^5 wdocument.write('</td></table>')7 h9 m: T) R. W3 W0 o0 o2 _3 A+ h+ i
}
7 H5 S2 }1 v S/ l1 t8 r}
3 r) D0 M/ v) P6 v6 q% f</script> |
|