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

|
网页之跑马灯文字特效
//修改宽度
6 e, y# t1 J: svar marqueewidth=3003 n2 v. w2 Z' X$ _
//高度, x( ^: i) b, O% Q; o9 C
var marqueeheight=25: J* `2 C( R$ F& K+ k& u
//速度(1-10)
) P/ S/ i: f0 ^& X k* j: @var marqueespeed=3% F% K2 d6 m9 l& b1 O- H7 q% g# f: X
//背景颜色
$ o' H9 b& a& ]3 Cvar marqueebgcolor="#FFFFFF"& }# V# V) l, X. W( w
//是否能暂停 (0=no. 1=yes)?9 A+ X/ K# \2 u; h9 g/ q0 b- @
var pauseit=1
" b. D* n+ Z: Z4 t) h
' P F I Z+ t//修改显示内容6 l! `3 j' k9 Z: x2 M2 s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ @0 x, j0 Y; N2 O) x8 W
9 I* o9 p1 l, |' e! \
7 @, h( V5 x: f6 Q////下面不需改变////////////
2 @% X8 V7 ^, `) B) W% [2 i) S# _5 e; [4 Q3 {/ W
var copyspeed=marqueespeed! l4 s# A W8 @ F4 j( Y. Z! S
var pausespeed=(pauseit==0)? copyspeed: 0
5 s# p/ K% X7 vvar iedom=document.all||document.getElementById- D% p( A7 e- }# r3 k- o
if (iedom)6 F4 S/ o# v# I# c8 l+ `/ \% T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 i$ r0 T9 A/ G" S8 n) {: e
var actualwidth=''
! ^/ W7 W* v& S2 [6 C: tvar cross_marquee, ns_marquee
! A4 U$ j0 f' ?* { C# {
2 M# n0 f; e8 ?function populate(){
. C2 P% N. ^! x' }4 E. L+ \8 J6 wif (iedom){* d+ k" I: n7 f$ U' o0 R5 E' V' |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- ^. U2 q' k5 }. `! ~ F. h+ {4 rcross_marquee.style.left=marqueewidth+87 p. g: G# p! m8 D/ a, }& B4 n
cross_marquee.innerHTML=marqueecontent- F O; \, k* I4 t" b# }/ t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 s# t) ?) j2 `
}
4 Z; o {! Y4 T) E- Qelse if (document.layers){
4 k& F5 S% x! \( X) Ins_marquee=document.ns_marquee.document.ns_marquee2: ^% l/ Q3 Z$ {
ns_marquee.left=marqueewidth+8
- k1 A$ g6 s5 M1 S6 Gns_marquee.document.write(marqueecontent)
; ~: z+ p- d; |, tns_marquee.document.close()$ K I' @9 t7 {! `& |1 X
actualwidth=ns_marquee.document.width) Q! n' u, S$ {& v8 o) _
}( F% h) `4 j1 e6 B# N
lefttime=setInterval("scrollmarquee()",20)8 h0 Z7 R. b% A' H
}
: l' J, X; E" U% x; bwindow.onload=populate
7 e8 ^3 q w: z O* X
, X* V- j" Z1 B: ]; [function scrollmarquee(){
L/ ]) f: O: e n: Xif (iedom){ S, H) q2 c+ d9 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 A5 Q8 H$ o6 t: E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 u0 B/ n+ \4 oelse
# \* w4 E# A& l5 Icross_marquee.style.left=marqueewidth+8
$ r* D8 m+ h* w+ M3 M: I
; }: Y6 T1 c4 r4 t}( c' M3 [* ]8 Y
else if (document.layers){1 B6 t6 b( ]5 R, i
if (ns_marquee.left>(actualwidth*(-1)+8))
/ o. z' `. K$ R- N* J$ sns_marquee.left-=copyspeed! r, X; i/ Q' d3 H
else4 ^! K+ X* r; o+ i% G
ns_marquee.left=marqueewidth+8+ B' }& }! Z% f9 u, p
}* l6 F3 G, H j" Z
}1 L1 Q. x+ P; v3 H5 K
. R5 C" H1 E" y: l# @1 y+ Gif (iedom||document.layers){# a8 P; U0 s9 ?9 A
with (document){
& X5 t" w! ^; u( Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 I/ ~6 _5 h* B+ V
if (iedom){% n8 u4 n; b2 A7 x6 f0 J) A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' e$ ^ T' O3 V7 z1 q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') m/ k' H; @+ t) ?- f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' s1 }0 y8 ?5 n$ ^ {& cwrite('</div>')
- s4 R& i o- k) X, f- ^}; W: b6 }$ e4 Q2 M' K6 F
else if (document.layers){9 }' n7 W/ \& J, y; a7 F* H) S8 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 G; L% c+ v1 z$ }- ]- g2 g# Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 [/ n7 e4 y) h, d+ y+ ]
write('</ilayer>')
# C$ f! T0 {" C. O4 ^, {! {}
( d' Y& B* p; cdocument.write('</td></table>'): m R* L7 N' m( e3 R9 b( E
}
' l- r9 g# l- t ~}
1 W: I, e/ V) |! }' j" ^</script> |
|