Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度. G, N3 b8 R3 ~" D* z8 w* b' H
var marqueewidth=300
) h2 A7 f. ^8 S+ G( w//高度5 @0 J% I( m% o9 f- Z: [
var marqueeheight=25: z0 h, s/ N6 S# W5 m
//速度(1-10)% x( @* ]  S5 v$ x+ Q
var marqueespeed=3
* O2 j. b5 `9 S//背景颜色2 v, L0 w' k1 [
var marqueebgcolor="#FFFFFF"
+ {. r" I3 G5 t6 B7 m6 ~) n; J//是否能暂停 (0=no. 1=yes)?
% t  [3 Y8 O4 svar pauseit=1- n+ N% [& z' U, r$ J4 ~
6 @+ q1 C5 m7 a9 f6 P! ]5 u- ~
//修改显示内容1 x" v) S  v6 K" L; T$ ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', z& }1 u% Q3 |' Z/ f
: b2 k0 P/ o& c& ~! n$ S  S# n

2 @! h5 {( w& g8 r" ~  ~' l; v////下面不需改变////////////* ?6 I4 h- S5 }! l& l1 i% Q
0 `7 E: `; B4 a9 p( f
var copyspeed=marqueespeed0 B" E7 ?# x! K! W. ^8 D
var pausespeed=(pauseit==0)? copyspeed: 0& G0 C3 P1 r7 s: @2 z7 o
var iedom=document.all||document.getElementById. R2 J7 @- X; p( d
if (iedom)
8 N1 M' ?1 M# Y& A  r0 Y! Z- ?5 Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  l0 w: c( A4 r- X9 e7 Q
var actualwidth=''  U$ J# K1 I8 V2 q: p% I+ g: y
var cross_marquee, ns_marquee5 U3 x- C; |9 |. r, r
! T( m- h  q. E* g' A- l
function populate(){6 L9 _2 Z+ e! `9 o
if (iedom){1 _7 K9 \2 K/ O& |4 {% J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 s( e, ]) b# r1 A% L
cross_marquee.style.left=marqueewidth+8/ C* d" ?" h3 {* y3 P+ `0 |
cross_marquee.innerHTML=marqueecontent' k# G/ g) \8 ~+ Z$ z1 }! O6 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) q# p" `/ s; Y3 k
}
/ \5 z0 v1 Y/ W/ |, f' selse if (document.layers){. @/ b+ [1 E0 W% v1 g7 B' K" X
ns_marquee=document.ns_marquee.document.ns_marquee2, b  Y) z1 v& o  v  p
ns_marquee.left=marqueewidth+8
& `2 {, L6 e  s! n. Mns_marquee.document.write(marqueecontent)
" e1 n6 ?& J6 H( V7 wns_marquee.document.close()) w' K2 P! D  r0 C, m( z
actualwidth=ns_marquee.document.width
' a0 @7 L1 J3 Z  ?) k* F}' _) l7 r1 z9 U
lefttime=setInterval("scrollmarquee()",20)% j% x- F1 j- u" h& }
}7 I/ u1 K+ i6 {9 x% W
window.onload=populate& u' T! H" p- A  s( C: m$ G  e

; J' D. h! t* i6 {- @. Lfunction scrollmarquee(){
# x: S1 X- \& @. H  ^if (iedom){; b) D) S1 B4 J8 B8 V/ Y5 f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  a! `! `' L0 h/ K3 _( F8 I" ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ `9 n. U$ a8 \1 \5 `else
" M# `- v: V% R; Z* scross_marquee.style.left=marqueewidth+8& ?5 O8 i6 T* @1 M& p' ]& t

# F* `8 O' W. D+ }. y' R9 r}
/ t9 G+ \4 ]6 `9 ~, K; Delse if (document.layers){( \( p! P" j0 Y2 i% A, V
if (ns_marquee.left>(actualwidth*(-1)+8)); `0 D" B7 C& `9 n. M
ns_marquee.left-=copyspeed
: L$ V& g* h! W) m2 J: n  r: F7 gelse# J0 Y4 p) y( p; P
ns_marquee.left=marqueewidth+88 N! y  r# z1 H1 G/ P" [
}7 N$ _/ g, L( }% K9 K1 W
}; Z" @% g& m) K& D
2 J+ J. S  A* W
if (iedom||document.layers){! Q* S2 r, f4 P  \8 S
with (document){/ n/ h, v0 S% g; f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 X. j- W5 G- E3 |+ Y. i9 Z
if (iedom){( [8 ~# v8 o6 K. N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. G1 m+ O6 p- l( n6 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ J4 [5 f! j( j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 ]$ K/ {  M; F4 ?5 @write('</div>')" ~: K. e4 S; b4 S
}0 w2 r; q+ Q/ k" f5 d# j* ~" D
else if (document.layers){; V. O. z8 q* y% ~+ Z% }# F2 j# |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 L- @7 W0 m) ~5 h" Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  E/ `$ v( D7 x/ x1 F- F$ jwrite('</ilayer>')4 G3 L1 t5 [: B5 n
}
. n3 @4 L. g8 V8 Kdocument.write('</td></table>')
  \- d- _! v/ B* ?" o; T}
- @9 G/ \+ |9 T6 e' J2 A}
& a; h' J$ c: \</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2