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

|
网页之跑马灯文字特效
//修改宽度
+ ?% O; A" }) ?9 h' Gvar marqueewidth=300' S' O0 e$ K. h; p: ^& ?, p
//高度
5 B) l: S. V# Cvar marqueeheight=25 y: ` U, y- e+ X+ m
//速度(1-10)0 a' r" r) V3 i) u+ e3 D0 ]- p
var marqueespeed=3, k7 R' n/ z9 ]2 n) ?* H! P H r8 g
//背景颜色
" X$ ]8 I1 z+ w& z _7 P. M- Qvar marqueebgcolor="#FFFFFF"
; l2 g0 E3 C6 r; R( Q' a//是否能暂停 (0=no. 1=yes)?6 T6 L0 S+ k- c* |
var pauseit=1; Z6 z: h: Z2 m x9 G# r
0 d1 `+ E g) s! Y% m+ f
//修改显示内容5 [8 x7 V/ E+ B: a7 t$ V* k7 u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( a' g, P3 s1 G/ Y! l& Z
K$ f: i5 Y% W; m' v" c) ~$ g4 X6 ?! Q( j
////下面不需改变////////////
A v$ J* F5 E* ^
3 X8 u3 c. U, i/ P# Hvar copyspeed=marqueespeed
9 f5 a+ Q1 [1 t' Yvar pausespeed=(pauseit==0)? copyspeed: 0
- k! |7 z0 D+ U0 f+ G/ s' Zvar iedom=document.all||document.getElementById
1 a W1 v# n5 b7 j4 O0 ?if (iedom)3 @& U6 Y4 T, q7 `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ^; l" S8 p5 p# g( V
var actualwidth=''
& `9 u9 I+ R% }& ~1 q0 ovar cross_marquee, ns_marquee2 H$ L0 e+ u. a+ O7 o. ` p
3 R8 x; a- o( cfunction populate(){$ u" {, p/ G6 ^0 ?# s* n
if (iedom){
( d& C3 t& f$ D2 N0 l) o2 ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 K2 d* E& a3 }' n& Y6 O5 u' N5 ucross_marquee.style.left=marqueewidth+8/ _/ N; `" M; U! {
cross_marquee.innerHTML=marqueecontent
& \9 ]% f) ?- ^& Z. A- S3 j, Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( Z4 m! y6 x; `% j* e}2 p0 I7 a+ J. v8 q" \$ _
else if (document.layers){/ b- }& j9 q) z- I' a
ns_marquee=document.ns_marquee.document.ns_marquee2$ I% [" T5 ?/ i j9 I- d5 l
ns_marquee.left=marqueewidth+8
9 h* |% F3 M. y* Qns_marquee.document.write(marqueecontent)8 a( p: T/ z$ k
ns_marquee.document.close()
* x2 w) p; y+ r$ B; h6 A+ h$ v6 P9 k! @actualwidth=ns_marquee.document.width8 y$ J1 \6 G2 U" w( N4 [2 R# _' G( R
}! W: D* Y( o4 G: X/ }( X
lefttime=setInterval("scrollmarquee()",20)
1 t& E/ R$ J! v) [}, A+ `( M6 j8 _) e8 J
window.onload=populate
' O' ]. G5 S2 b( s+ [' `# Y, o$ Y' L; L
function scrollmarquee(){
' q' C6 Q8 H# y+ s( Hif (iedom){
, N$ s# k* B* E5 ~) e- Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 q) }/ ?% P2 O1 N/ Z9 Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) m: E% u5 q8 b& n# }! m5 W6 {else
0 P# ~ t3 s; v" J% Fcross_marquee.style.left=marqueewidth+8
# [7 l5 U/ t1 t% @4 T+ @8 |8 ?% i; F( C- }' `
} [3 U) G* |7 _* f$ J
else if (document.layers){- B+ i0 ^- |) N6 n3 Q# q/ [+ ^* Z
if (ns_marquee.left>(actualwidth*(-1)+8)) ^* D5 O' h2 `+ L2 f7 O6 P! }
ns_marquee.left-=copyspeed
5 K6 [. G4 w0 j" ^+ Welse9 o" J5 h+ f; y: d; f9 R
ns_marquee.left=marqueewidth+8
/ ^0 Q* W1 ?# O9 S$ e) w}$ I7 s6 f3 j$ v7 y4 H) d
}
+ e9 `: o8 d, r
+ J) g5 w; c2 ?) _# Hif (iedom||document.layers){5 M0 C9 L7 R7 z, ?( E/ u
with (document){
/ ~4 U. ]$ h+ n0 X* z$ _/ Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# f5 S( X L7 w( F# T ]if (iedom){: A- b7 \: N3 P& I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ A4 S# ~+ X9 k6 D, I( W7 @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* S1 G$ N/ Y$ f3 t6 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 R* A: p! {1 U( g: b+ F9 Qwrite('</div>')- G2 o8 _# p$ h; w6 v1 i- C i& U( O
}# Z+ ^# H% B1 N* D, `/ T' G
else if (document.layers){ a: I, P! y% r5 \6 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ }- B% z% W6 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), V9 p7 w+ A+ \1 g, r. H2 R2 ]& [
write('</ilayer>')
! V2 e8 A: {' l) B6 b7 z* e$ }}
6 R7 r( l8 i( {; m" N' {document.write('</td></table>'); f- n7 Y% J0 T, l5 _( T
}
4 V8 F7 z* i' o5 Q% d}( ~4 U4 Q) k* t
</script> |
|