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

|
网页之跑马灯文字特效
//修改宽度
4 ?; j$ v( [7 v( t- i9 V4 tvar marqueewidth=300
/ x: m$ i, d5 O E//高度+ Y- T2 w4 S. ?4 I
var marqueeheight=25. d1 ~- ^& D! x6 ]
//速度(1-10)
) c6 D1 B1 I$ {2 P0 l# Y7 pvar marqueespeed=3
- f* j7 R; j) E//背景颜色
8 K: t* Y& v( l1 B/ U8 Zvar marqueebgcolor="#FFFFFF", p8 W# W5 K- b% q
//是否能暂停 (0=no. 1=yes)?7 Z0 J0 n! t( f8 A
var pauseit=1$ Q7 J0 x5 @' L" J, B! _5 g5 ]# W/ x
& u' T: N5 w. k. A4 ]9 ]//修改显示内容
" y: Q5 m& K' K* s) zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 d5 M8 O# d+ @1 z# i! n1 k
. H9 e9 }( [+ i/ q+ t9 m" ~( s
+ Q! W. e, Z) d' W
////下面不需改变////////////8 `: e/ z8 G i+ @: O' X
: {! V+ j( N9 e1 Z
var copyspeed=marqueespeed
# Z" E. H% q& g( _' C5 n5 dvar pausespeed=(pauseit==0)? copyspeed: 09 g2 h( C% _) X! r' z
var iedom=document.all||document.getElementById6 Y8 t( ~( f" F
if (iedom)* j1 B5 T/ N7 ~2 I* B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). H, g( Z3 A2 n( G T4 R/ {
var actualwidth='' d3 G2 D5 q7 w5 J
var cross_marquee, ns_marquee
2 _: g" c# [& m3 O5 L9 Y7 t F+ T7 p$ m
function populate(){
5 o# N+ H9 @+ ^# U, Uif (iedom){0 H, `$ ?( }- P& }1 ?; O# Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 k% l6 V2 }) P% \: @
cross_marquee.style.left=marqueewidth+8
3 R" ?# G% e, D3 `" x q5 j. P& jcross_marquee.innerHTML=marqueecontent& O' S7 `+ z, _& [0 v0 j% u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' [/ ~1 e# u. e3 K}
3 J. z/ V$ K% Welse if (document.layers){
% s- b- h/ C% y3 g. U" Yns_marquee=document.ns_marquee.document.ns_marquee2
% a7 T1 Q4 j2 hns_marquee.left=marqueewidth+8
2 k4 r3 k$ _- U7 {9 Z/ Jns_marquee.document.write(marqueecontent)
( h8 r) C) Q) D1 K9 r8 Tns_marquee.document.close()7 b+ ^# d' o3 C
actualwidth=ns_marquee.document.width/ g* j; v# C4 q1 E$ ^& b9 f# O
}0 H" t9 H! U% L& X
lefttime=setInterval("scrollmarquee()",20)
7 B) o' _7 c5 ?+ x}- D% `7 T6 m' X) O: r
window.onload=populate
, P ? o( q7 C8 G! t/ A5 z% T6 k5 O6 u" A6 Z+ l7 Y& b% R
function scrollmarquee(){
# l3 P. K! _0 s- X& P; Bif (iedom){
: s& H" b! m% i$ G. Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# n0 m8 G! Q8 z4 L! C$ pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: b! c% J2 r" n6 y
else, X% o. g7 Y! F" L# M
cross_marquee.style.left=marqueewidth+8- y, _5 ]" n/ F8 z( |' {% u2 g
& s% q; N7 X" x8 O: o0 H& C7 K. b}
( H7 T4 u* Z& s8 o v+ lelse if (document.layers){
0 `+ E6 C0 V( Yif (ns_marquee.left>(actualwidth*(-1)+8))1 Q! @) G. M* f! Z/ k( D
ns_marquee.left-=copyspeed, _9 J8 `: g. E7 w
else
- h( o( z7 B4 t0 ]6 zns_marquee.left=marqueewidth+8
4 b. Y% Q$ o7 ? t" l/ F" S @}
: ?' W8 Y6 b1 Z/ w5 w}
) H# J+ N) c. |4 o4 A0 e
: j/ |/ G' B( G: Oif (iedom||document.layers){
! s ?" A% D7 |& X! E2 v# rwith (document){# |2 B, |/ O, K* P& g# r3 F2 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% ~& a' R! k( u( r$ R+ R- s
if (iedom){
H% k' n! ]/ Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). _8 T- z8 `/ u, {# d0 J! u* L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ x# S' \/ {" k' wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ T8 F6 t( v* v
write('</div>')
" M; I" M0 g }) m! @2 X4 k) b}# w$ {7 j) d4 w* }; z2 p
else if (document.layers){
. [6 t7 ?' U% Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 ^5 }3 |9 C, r; }0 T5 S' V P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 a+ }! E+ l% [4 {6 R
write('</ilayer>')2 M% ~( q8 G$ H- }6 |
}
1 l1 Y# k7 `( W( z. e+ V& y$ ?+ `document.write('</td></table>')% T5 i7 \! v5 W5 E
}5 [# m% b Y t' V2 J
}. l# D' E. X3 @ ]. U1 J( s% F- S
</script> |
|