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

|
网页之跑马灯文字特效
//修改宽度
5 L& K+ n$ A+ ?( Q/ P( c& r2 ivar marqueewidth=300# [; D4 R/ F6 h8 b# \$ d1 J0 O
//高度3 c+ Q9 W1 ~% a4 M6 N
var marqueeheight=25' W" ~9 s) h9 T& Z
//速度(1-10); R2 \5 r2 U% z& w4 _3 q
var marqueespeed=3& S0 M* K% D* g: Y/ q
//背景颜色7 E$ a2 s+ O- v- T; P
var marqueebgcolor="#FFFFFF"9 b% \' Z% z5 K
//是否能暂停 (0=no. 1=yes)?7 B0 ~" Y; d* r
var pauseit=1
2 j% Q! c8 T8 I4 T- ?' L* X7 O8 v3 J: b. M* k6 x1 _
//修改显示内容* ?. s. x' k3 j& ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# G1 z8 D. P; O r; W/ \
" G" x* D$ l0 K& _8 |- Y
3 [ k) H" Y5 w////下面不需改变////////////7 n5 w+ v# g, W
' A/ ^+ X7 L K
var copyspeed=marqueespeed5 _& Z- o5 b$ A# G
var pausespeed=(pauseit==0)? copyspeed: 08 @3 T% z4 q: O
var iedom=document.all||document.getElementById9 O8 q& ^9 K2 A8 P
if (iedom)
# m* n8 Q7 \( W5 Z5 E" wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 |% L/ m) a7 E( r0 s% E3 f
var actualwidth=''
, G" K! g3 P- Q4 M& zvar cross_marquee, ns_marquee a( H' b& W/ n: r+ `
$ t$ w" k8 g: Lfunction populate(){" a3 n% u" z) i9 Z; X6 A
if (iedom){
) [$ U |8 ~! l: w* n" scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 X% V4 ~7 t' W9 G: O7 l
cross_marquee.style.left=marqueewidth+8% G: n# @. j) a7 Y
cross_marquee.innerHTML=marqueecontent+ b4 ~% g2 }( R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 T, r/ o. p; H7 l6 ~% s' T
}. q# N4 w+ U2 t; B+ F% u+ @7 G
else if (document.layers){- Y; h" C _; i7 T
ns_marquee=document.ns_marquee.document.ns_marquee2
- k/ o% d+ Y& K2 O' u9 f; Sns_marquee.left=marqueewidth+8" y! Y- J8 i. n/ ]$ _
ns_marquee.document.write(marqueecontent)
5 s! H) |7 ]. C# Zns_marquee.document.close()2 d$ [$ Q# u9 E# ~% F! x$ o7 Z
actualwidth=ns_marquee.document.width
( w. F; v( d8 G; t% f, }, B}
; k3 L, [/ U; j% Flefttime=setInterval("scrollmarquee()",20)
% b9 j' Z5 V) a6 ]/ o4 a" `9 X. F( }}% r6 B+ N! N" x
window.onload=populate- x, |2 L; v; x' m6 a
# p. l2 s% q# k
function scrollmarquee(){: f5 P2 Q9 G8 N6 w
if (iedom){; L3 Y1 D1 t: e( B$ j/ E" }* O# f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* X A2 s4 E$ V; l. P2 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) j8 Z: r; u* ?: ^7 d! x
else* a& W! P/ R* H2 U9 `0 ]1 J2 T( ?7 `
cross_marquee.style.left=marqueewidth+8
9 S& V0 s& D- g' Z* N: I* e1 W4 M
# ]8 g. B) s( t& u}
) `7 _4 X, g2 E2 k( S4 S, Felse if (document.layers){+ w5 S# {6 V5 ^$ s" y
if (ns_marquee.left>(actualwidth*(-1)+8))
7 }$ N- _5 K/ p% {7 X7 g5 Y2 @1 v7 Y, F5 [ns_marquee.left-=copyspeed
8 J" o2 ]8 X7 u8 a% G: aelse7 u2 r' `* f# F
ns_marquee.left=marqueewidth+8( w; X5 @6 ?& C% z9 r H" c" a
}
" G2 @2 d z4 r/ k}
: Q& R. ]% Y* T/ {2 W1 z( H$ V" m( F2 t2 i, E
if (iedom||document.layers){
# n( u0 r8 `- `: Lwith (document){ ~2 ^; W; `: @" ?$ R4 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ V0 t" }( u3 W
if (iedom){
8 k R# Y* m$ W/ M9 o& Q3 z" pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ v- [ T, ^" [. wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( y! l0 \9 ~7 q5 E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ J( U) p, v9 Z+ R( T$ {/ L) C8 C- C
write('</div>')
) A8 C+ \4 c& C( H}" Y; u8 F/ o, t& G
else if (document.layers){
) F8 u6 y6 C! J8 b7 ?& Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' N+ k) ]" J0 z* Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' _" Q2 x$ \; c
write('</ilayer>')
4 W" u; Z) b, F" o" m}
. E7 h+ S& M3 t0 B- X ^document.write('</td></table>')
P5 t3 z, E7 g2 \}0 U( w& F/ U) q7 }3 x8 M
}
) X* a- D7 B6 W</script> |
|