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

|
网页之跑马灯文字特效
//修改宽度* t8 t5 \4 C# J
var marqueewidth=300
. h1 O' C5 u7 Y; f! J* T! r+ g//高度1 U% Q6 v6 A4 t9 I" F
var marqueeheight=25
' N1 A0 y* p. B//速度(1-10), n4 f9 U7 i0 N/ ~# A
var marqueespeed=3
4 d; j% O7 F" j* e( D5 k//背景颜色
6 E3 q$ {3 @1 L8 g+ i! g" R/ j9 G' Avar marqueebgcolor="#FFFFFF"
8 O4 u7 A9 k3 h5 F* k$ [: P; e! b. u2 ~//是否能暂停 (0=no. 1=yes)?8 x W& J+ H8 H# D& e
var pauseit=1
& Z% N; G, m |; T5 C+ d4 W! K# a8 m! {- b3 L
//修改显示内容
, i% R# ?6 m3 n1 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 U, @3 f+ ~( u1 Q
4 w8 n$ c$ Y: Z1 I% f$ o* L" |- ?+ F, ^# o% e
////下面不需改变////////////
% S6 M( d, a# @# g) {3 }5 z; X1 l% M
var copyspeed=marqueespeed z' v) T5 i3 Y+ s
var pausespeed=(pauseit==0)? copyspeed: 02 N' Z( D# S, e3 O
var iedom=document.all||document.getElementById$ f. f8 ]( J' u8 g, Y& [& `
if (iedom)
- I$ w6 ^) X# {9 s4 g/ \+ n" }/ Bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 U; ]; H4 ^1 h* u
var actualwidth=''
, S, i3 T1 T+ ^) R# l! V' q1 D8 |( pvar cross_marquee, ns_marquee
; z G7 j- g' H; f" G
8 m7 u+ t4 c1 J) afunction populate(){% r* ^* i6 M9 G. |! O" n
if (iedom){
x1 U" l; Q# ]" F3 Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' r2 B/ ~) M3 `8 |2 Hcross_marquee.style.left=marqueewidth+80 e8 j* K g1 j% C
cross_marquee.innerHTML=marqueecontent$ @6 e$ G# I& `9 u6 I& [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( @4 \) h, r6 W5 ^}7 q9 w, }) F4 P3 _) l
else if (document.layers){
5 l( q A* h/ }1 Q+ g: z Nns_marquee=document.ns_marquee.document.ns_marquee2
# M. f) ^. y: D6 Y% K+ ^+ Lns_marquee.left=marqueewidth+8
, W7 r% A% m0 ^ns_marquee.document.write(marqueecontent)
: D2 F' c3 J# D% V( l3 A% {ns_marquee.document.close()
1 i8 e/ d) {2 f& iactualwidth=ns_marquee.document.width5 c; Y0 Y* b2 t( A. K4 d8 d9 V
}
" W, q" V" l" S# F) k( F! m, Plefttime=setInterval("scrollmarquee()",20)
) t1 l0 j6 _" I) |& W: A* O+ a}
. A6 E3 F( k) M# B# v. _( W# Wwindow.onload=populate6 M: h( I }- O' \. j" P" B
/ Z/ d8 s6 c0 p, h6 r9 B
function scrollmarquee(){
( G! ^. t1 L/ P$ tif (iedom){) Z" E& B& I9 {" f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 g8 Q! |3 I) Y2 A$ w5 y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; Y5 n2 h {7 o( J" L) s
else
D# f& N. c" W2 I: U) p Jcross_marquee.style.left=marqueewidth+8
$ v1 Q5 d$ c4 x( J' D. t( w/ A3 z# v, B3 `8 C! S
}' @2 \* E1 d% z- Y
else if (document.layers){
7 j4 l2 ^" w- b: z, hif (ns_marquee.left>(actualwidth*(-1)+8))
' w8 E& e' e9 J6 c" Nns_marquee.left-=copyspeed: e1 C B. X7 E6 h+ Y% o+ I
else
* R. M( P3 X7 Mns_marquee.left=marqueewidth+84 C" G3 n7 A' S8 h, p
}3 T" f0 T v$ s' E% B
}
3 Q1 r0 D- i$ b& _2 Q0 `' S- L: \) }: l4 t
if (iedom||document.layers){- ^9 P! Q9 x5 E& _9 S
with (document){ R& ?4 u% s) \7 z5 E& V2 ~, P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& [5 l) Y& k2 y; Z3 hif (iedom){
7 v! | e: Z+ e$ S. H( Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); D6 M- }( K6 ?$ ~+ \0 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' H4 c! x" M, _9 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 H( F j4 Y8 W: s
write('</div>')
+ K4 l* M% [8 \' R}( j. D, _ R2 N; G p$ \% q
else if (document.layers){8 w: U: ?' b: _1 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' z$ t: J4 T$ V8 {3 K4 D9 E4 X; S! d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ ?1 i2 H7 B% Q( Zwrite('</ilayer>')
! j M) u9 d4 \5 v% E) `}0 S# d2 K. X- a- c9 ^0 z, h; W+ T/ [
document.write('</td></table>')4 c+ c" L$ c$ M2 I3 f1 l9 C3 A& V
}
: b+ g( t% R5 {}
7 _# ]% p) B; _' B }5 d3 @* o9 U/ F</script> |
|