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

|
网页之跑马灯文字特效
//修改宽度* Q8 V% }4 F/ f5 F* C% _8 g
var marqueewidth=3004 o7 x6 V: C% s$ F, r
//高度9 L& `; }4 j ?( P9 {2 J
var marqueeheight=25
' N4 K* F7 V0 C# F$ Z! N% u//速度(1-10)
/ l* D4 I2 {% U4 a$ zvar marqueespeed=3
N3 L2 [. O7 [. V' l//背景颜色
2 L" E& y# z9 ~; ?/ O6 uvar marqueebgcolor="#FFFFFF"
% \: I$ b9 H& H( ?2 ?* h, ~//是否能暂停 (0=no. 1=yes)?
, n4 U( E4 A7 ~& ^4 uvar pauseit=1
: b1 A' g1 ~& V& A0 i: j4 J7 q
# }. }8 G8 I1 G//修改显示内容
" C5 _/ N3 j6 Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 c$ h. X" M- w* j; d5 s) K8 q; p
, L% F6 q* p& |" f8 g$ j
////下面不需改变////////////3 |3 d. G; j* T; @' c8 `2 y& E
4 N. D; X" d! Q% W
var copyspeed=marqueespeed, \+ e( ]3 b8 i. _( n5 ?- U
var pausespeed=(pauseit==0)? copyspeed: 0
) z" ]/ t [- }7 Y7 L( s8 l1 A* ?var iedom=document.all||document.getElementById! _1 s: k: {3 X0 n/ b; E
if (iedom)
: B8 P% W$ T: f) Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 g p: D' q; B0 I. i' r) |
var actualwidth=''
9 i; C. W) F5 K* q# y6 c, Dvar cross_marquee, ns_marquee+ u5 m! U7 l3 D2 f% `
8 {$ a5 R. E N8 m# C" @* x+ y
function populate(){" B; S, }, P& f+ Z
if (iedom){9 c4 U2 ]$ h* m1 o6 z$ T9 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 y* {! b! G4 V9 b2 F3 G4 d
cross_marquee.style.left=marqueewidth+8$ D _$ I' {: B% m# j) q
cross_marquee.innerHTML=marqueecontent
4 S+ j$ L" V; T0 i* \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 u8 G$ z; x& f) C7 D}
$ q* h$ Y0 ^0 c& b0 Telse if (document.layers){
; z F5 ?4 |; H( B4 F8 U" fns_marquee=document.ns_marquee.document.ns_marquee2
' a0 z+ j/ |2 v Y5 G2 r' p5 h! f6 Ons_marquee.left=marqueewidth+8
* R4 ^# ^- C+ x2 d) N& Vns_marquee.document.write(marqueecontent)6 T/ e% _" V: G; B9 A W
ns_marquee.document.close()% Q! ^6 x" l7 a; `/ P) F. L
actualwidth=ns_marquee.document.width+ `7 g: ^+ K- J# O9 v/ z8 p
}6 i3 V+ ^/ [ X9 C& P
lefttime=setInterval("scrollmarquee()",20)! r6 O4 L" [' r' s. T" B
}
! o7 ]8 h z7 o0 mwindow.onload=populate! k% a$ C J" ~9 l L. G5 I6 i ^
5 i0 m e' j3 f& qfunction scrollmarquee(){
( u3 b! @, [& [if (iedom){
4 A( M d& h' |: Q+ B- Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 \! j$ k. j; ^' _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 ~" N- E0 s' K* v% u: y/ \1 |else
+ y5 M+ c0 E8 ^0 `+ P9 c2 Zcross_marquee.style.left=marqueewidth+84 c9 E Y$ f; R+ i: @
3 x/ M7 ]- H/ I
}; O1 y# p1 `( G6 V
else if (document.layers){/ |1 A1 f/ u8 J# \ k
if (ns_marquee.left>(actualwidth*(-1)+8))1 o$ j* D) S, l8 |& z0 K, Z7 E
ns_marquee.left-=copyspeed
- V1 p/ h6 O3 a0 w9 qelse# @+ r$ W5 f; d' j% G' v; O9 K
ns_marquee.left=marqueewidth+8
. i& y; g8 B- ^% _2 F1 j}
6 [' G, b. q$ o2 i}
9 c5 l2 j) K- C3 M N
7 }" ?& E- n+ s, m9 q( yif (iedom||document.layers){
6 E+ T: y" N+ M7 iwith (document){" B: ~+ p$ H/ g$ m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 @- _$ o- v* Nif (iedom){ r, T$ k8 V7 u6 c4 _, S# {" |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 K' q+ J' G0 o' p+ o' s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 O9 Z: n; y3 t7 G4 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- c+ d7 h0 l) x
write('</div>')
2 b8 P5 f4 |! @ E}
p h9 v: }6 r1 V j( Celse if (document.layers){( Y- V/ J" e# I% N; \( ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& h, C6 }% x' t/ E+ R/ {! r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ Q: i9 D7 S, j% c
write('</ilayer>')
" P" W+ @9 L$ C}
5 X5 |* h) m$ M3 ~document.write('</td></table>')
" Y t' ~( a4 q( [3 M7 E( p" k: E}( Y8 H d& {( P$ b' w5 V
}
8 g& f) y9 E I* k. h* Q</script> |
|