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

|
网页之跑马灯文字特效
//修改宽度* v5 T$ A3 A8 S6 s7 {% E3 r, x0 j
var marqueewidth=300
% K5 p0 |, S1 R//高度" J% E! W0 ?9 N, V9 t" B/ ~9 y" G
var marqueeheight=253 S* M9 H, G `; @+ P/ Y
//速度(1-10). s' j. D( f) _( n" C; L( g8 R
var marqueespeed=3" O0 {7 {* Y4 c) y# U
//背景颜色7 D8 \9 Y y) c/ {) r3 P1 \
var marqueebgcolor="#FFFFFF"
/ H) t! U9 k- I0 d' b//是否能暂停 (0=no. 1=yes)?
. s" I3 H ~4 n* _/ M* E! k* K, @var pauseit=1
4 n1 f: ~4 k- @2 t
1 l+ J$ E( D D) k. g* `# k//修改显示内容
) H0 M$ R2 E6 u, U% ], }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ O/ `- B6 l( w2 F# z9 R/ ^
H& s8 ~! f7 S* \/ @% m2 L% O# N! u# I
////下面不需改变//////////// Q5 [! `; `. y1 M# ~
/ n Y6 c, t) J0 Y! u2 Evar copyspeed=marqueespeed, u% O( r4 r0 @4 @8 p
var pausespeed=(pauseit==0)? copyspeed: 0
: R. S* s% K$ svar iedom=document.all||document.getElementById
) C( C7 F5 p3 fif (iedom)
/ s5 t) `, _5 g0 W1 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 c! Z2 V* p& v/ X0 L7 y5 E4 n5 t
var actualwidth=''
1 s% I& r- G+ s: `var cross_marquee, ns_marquee
* U' z8 A! ] {; {2 r; N2 }/ f2 R M& P" Y
function populate(){0 ~" G" ^0 e6 }8 I+ @
if (iedom){
: x4 ?# c& i) y5 E6 \7 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 G+ c; S5 p' l7 z \/ m
cross_marquee.style.left=marqueewidth+8
7 e6 ]& Y8 W' m/ \" d5 Pcross_marquee.innerHTML=marqueecontent! m* g: Q$ C P0 i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# W$ w7 y' x' W% ?: [}
$ a) K1 [+ V/ f2 t6 Z8 D0 N" E" [else if (document.layers){6 f4 t% |0 s$ p8 ^, |1 B' Z6 X# e
ns_marquee=document.ns_marquee.document.ns_marquee2" c1 u) p- g' S- B0 t3 g
ns_marquee.left=marqueewidth+8" Q* q0 h: f, {) q
ns_marquee.document.write(marqueecontent)
; e, w% b. H* p0 j0 u/ D7 Vns_marquee.document.close()2 I% Z- M$ X e: i
actualwidth=ns_marquee.document.width. `& P: e" b0 p* Z+ p
}
2 ?6 l3 h# R2 { d$ Y: Glefttime=setInterval("scrollmarquee()",20)
0 j& B' R1 z' r7 \) s2 k}$ I# Z( j# P. L
window.onload=populate
) e/ E, u+ u S. n& U1 i
, q2 L& b! K4 xfunction scrollmarquee(){
: [* c# U* \, `$ t. s1 D- tif (iedom){
/ u( R" w# J r" O# vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! z0 k* A1 Q1 H$ Y, s. dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 u. i; }5 f: E1 \4 S
else$ ^8 x- n8 N `; o3 P
cross_marquee.style.left=marqueewidth+8
- J! F+ V, s" D2 ?! \" g& v1 T" H' Z6 u3 Q( P$ W
}
- U" R# N7 w5 @1 Belse if (document.layers){
' y, |, w: T6 x/ j! P& |! q8 Cif (ns_marquee.left>(actualwidth*(-1)+8))
b/ ]( ^7 w4 X7 g; ^# Gns_marquee.left-=copyspeed
. F3 n1 n3 p: B& U' t% Q" xelse
3 P( D4 W3 |& J/ X5 ons_marquee.left=marqueewidth+8
( W; a% y6 U, Q) p5 I+ n% k3 ~5 {. P+ M}) d( V6 E8 k2 h/ u
}
5 ]3 e+ s( c8 W. N6 K, [$ P" q2 A' A
if (iedom||document.layers){' o2 k; J _) x1 P; N
with (document){
, z$ @0 M( d" `3 A8 F1 J8 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- H! O' l. Y* r9 W; `1 wif (iedom){0 W4 r! q9 c* f9 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# e, \# p1 H5 [$ g; ]4 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 n( o2 I" T- u) s3 A! G1 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ c2 c0 C7 @/ P5 U9 A9 O$ E
write('</div>')+ k% Q/ C4 Z1 ]. b2 c# D. D; T
}, x# u+ r9 |) n- g* O0 X
else if (document.layers){8 o& `$ h6 e- i6 c# i1 v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ n( \+ X8 A/ M! y3 J+ C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' u6 v. L" T% U6 b" k
write('</ilayer>')
9 y5 o9 ?3 {5 G: H}; `/ [0 q4 K) r/ e2 w
document.write('</td></table>')4 E/ W3 H" Y3 q% J: J
}) L: a3 {: u+ J9 M2 t" L
}
# `4 X4 z% ?/ f- S! Q2 Q& d$ I</script> |
|