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

|
网页之跑马灯文字特效
//修改宽度$ e! Y6 b6 M9 L+ ~) d
var marqueewidth=300
; W4 g% g7 P5 G' S" I. N9 k' u//高度
0 L) Z" D, l$ \3 x( h4 Zvar marqueeheight=25 `) ~; k5 @% J/ f
//速度(1-10)3 V- E6 {( e$ `9 v* x
var marqueespeed=3
$ a- C" _1 i! N9 A5 R//背景颜色# u8 {. Q, E: f5 K3 u$ ]4 I5 }
var marqueebgcolor="#FFFFFF"6 N' }$ w/ d+ f ~
//是否能暂停 (0=no. 1=yes)?
2 b. b3 E7 Q( G8 Rvar pauseit=1
8 n: _& y- U# K! `4 F
- l, k' m( _" K) | g- M//修改显示内容
, q2 f5 V( P! z8 Z: U9 h& E, Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% R2 Y4 K7 V' ^4 I0 {: N( h/ d. b4 a* y; R
( s) q* a1 a' M- }////下面不需改变////////////
% C' n! _1 D9 W7 L% A& x4 X( O! Q2 Z
var copyspeed=marqueespeed0 |6 r+ Y. I8 O
var pausespeed=(pauseit==0)? copyspeed: 0
) t4 V+ u4 ~! C* s) [2 m# Gvar iedom=document.all||document.getElementById
9 W: V8 H w+ jif (iedom)' ]- z/ E- _+ D% ]8 w- c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' m( A$ b/ o3 J! C; ivar actualwidth=''5 A5 u5 t Q2 S, Y9 z$ a' J
var cross_marquee, ns_marquee
" x4 u3 ?$ \7 D( m- Q! A+ S
. n p5 `0 i: B7 o6 T/ ?& dfunction populate(){
1 P+ v$ a" Y; Uif (iedom){
; a& R3 G* Z8 t7 d: T6 w& [: qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: B( A0 W6 K; [7 _7 }& o& kcross_marquee.style.left=marqueewidth+8$ ^, }# l- G' `8 p/ c0 o
cross_marquee.innerHTML=marqueecontent
, s9 j/ V' [ F- _% Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. L1 J. _) Q3 B6 |
}
. E4 ~1 G# T4 l4 i4 g$ q1 velse if (document.layers){+ r7 U7 U! U" K9 ]9 Z# }% R! m
ns_marquee=document.ns_marquee.document.ns_marquee28 [, Y# d1 Z$ [) q, h+ {0 O9 P
ns_marquee.left=marqueewidth+8
9 B5 c, s$ S" ?( R" o l- \7 ]ns_marquee.document.write(marqueecontent)
0 M+ J7 `, P: i1 ^% dns_marquee.document.close()/ y; q3 d8 \' D$ `3 p, \
actualwidth=ns_marquee.document.width
) P. b% L8 ^+ {: f, @0 A+ Z}
. e3 n; i1 j& X' Nlefttime=setInterval("scrollmarquee()",20). l) o' F0 a) r8 |% Y8 L6 t8 Y$ D0 r
}
0 z1 k- S; z( ^window.onload=populate. |$ M2 W% B y- O
8 A8 V d' A' L+ V
function scrollmarquee(){1 E, Z# G' A) Z5 t" h
if (iedom){# M8 W0 w2 b$ `) H/ l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, H. f: r/ P" S; Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! N" W3 Q% O) D" g3 O' p3 b' a1 oelse3 ~- y( Z" W" \9 v* d! N
cross_marquee.style.left=marqueewidth+8
' C; g' q7 K$ `+ T0 i) {7 G. U B: F7 I, U. m, N; r0 p% I& M+ I
}
! l7 I& R" ^" S9 h: Ielse if (document.layers){5 m5 M# `* X) W% m8 M
if (ns_marquee.left>(actualwidth*(-1)+8))
* W0 u/ B# T+ k" Pns_marquee.left-=copyspeed
2 q: G, f6 X. [. n9 o' N$ p/ K5 `! Xelse4 T' L0 k# d8 n# T* F
ns_marquee.left=marqueewidth+8
& n1 U6 w- x4 G/ v}) O- l% e3 `5 \ a
}
; m3 ]4 b4 _) {1 q5 t
I: Q7 m. U4 v' ^if (iedom||document.layers){
6 N# G$ \3 i, q5 D8 lwith (document){
8 p$ T% G# U* C, }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% P1 c3 M+ S$ A( Bif (iedom){
6 ~& P) A7 O; I# ?8 Y1 C+ u$ mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 b- a) c2 g* P) m" W# ?5 f7 H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ A: c5 b: K h9 I0 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! R2 r8 i- Y0 K5 r+ n8 G1 Q& a4 K
write('</div>')
1 w( F3 a% s! {1 n4 x}$ b+ V: V+ k3 U$ C6 y% e# x
else if (document.layers){. x! [! w3 a% J2 ]( t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* d( i/ v9 K( I1 t& P5 T8 l) uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 @# K' c/ K' a) W. X$ E5 d# G% hwrite('</ilayer>')
% F+ ^& ^% H$ i5 P K8 O. f. l" Y} a4 M1 s4 }. d% a9 h2 I
document.write('</td></table>')
. }, j6 I; `+ G) ?2 R}* E) R5 O: Y1 f- K8 R; _
}' Y" [& }2 j: N
</script> |
|