返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Z$ Z& ?# L# B5 @" x) {3 tvar marqueewidth=300: C) Z1 L6 u. D& e6 Y
//高度7 T$ {6 Q/ o4 L) e, ]
var marqueeheight=25
+ K' o# M! {/ r! B" u//速度(1-10)
& k; z1 N' }. ?* j" O: J4 s% svar marqueespeed=3" K2 q  z& Q4 N! @+ p" \& S, L
//背景颜色
5 O, h5 B+ G1 G# `  n8 Bvar marqueebgcolor="#FFFFFF"
; w6 S; u# b4 d2 \& ~$ s9 @0 b//是否能暂停 (0=no. 1=yes)?; O: p% n/ W$ L0 G: e3 S9 C" n
var pauseit=12 D. p( q! e. U  W. u
5 u# f' E. X: R0 {8 L
//修改显示内容* d% y; [* z' h% L6 e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" I& [4 p0 e+ C% R4 X/ v5 _$ ^3 n  k; M, ?9 H# Y1 D% l
4 y1 l( j. \* {- |
////下面不需改变////////////8 d) P: B& o7 q3 U) g4 y; r
6 b1 ~+ m4 \0 W) O8 W
var copyspeed=marqueespeed
4 ~- M5 T+ x  `* h5 bvar pausespeed=(pauseit==0)? copyspeed: 0) @: _9 I0 c2 y" X; i. e
var iedom=document.all||document.getElementById6 }: F1 X3 V! [4 V* b
if (iedom)
+ W# ^8 o5 i; Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 S- _7 d  K! g4 U6 p, p, T- ^9 n
var actualwidth=''
* P. }" {5 X) c" F, Ovar cross_marquee, ns_marquee
5 V4 L' |1 K4 h, ?# T
. r& M7 @3 ?( @0 ^3 xfunction populate(){
9 Y  \% ^$ z2 ?8 l1 D5 g6 l/ P$ ?7 yif (iedom){
3 y. r$ y$ o- _: o" r& ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 N6 `8 j* a5 dcross_marquee.style.left=marqueewidth+87 M0 C" X2 k# M5 v  ^! V3 Q& A
cross_marquee.innerHTML=marqueecontent) F' k3 r# y) z# F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 B0 b/ Z8 H# [! ~7 N4 ~}
  ^- P6 Q, b: N1 S. delse if (document.layers){
! ?0 |9 `2 S3 M6 \5 Xns_marquee=document.ns_marquee.document.ns_marquee2
$ s$ M$ c4 x7 V7 M' ]) g6 xns_marquee.left=marqueewidth+8
& G) x; [/ }. \0 {* Gns_marquee.document.write(marqueecontent): Q5 O2 E; A6 i* M; \
ns_marquee.document.close()
1 e- i/ R; v# t! C7 \actualwidth=ns_marquee.document.width
. S0 D" m2 h: s+ ]}
* q" K# \4 @! M  f( M6 tlefttime=setInterval("scrollmarquee()",20)2 ]3 m) n  u1 O6 `& l3 w
}
. H/ G6 ]; @+ U/ I8 Twindow.onload=populate
0 K  m; W. J& a/ }
% Y1 ^3 p; k- N$ qfunction scrollmarquee(){
+ t0 X) G% z9 D2 p/ j. E' Zif (iedom){
$ j: p7 }9 A  hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) i+ b) Z# Y' [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: e/ f0 y- b) y  ]* J
else+ h/ x) I3 t6 I0 s! m
cross_marquee.style.left=marqueewidth+8
3 y$ c, H$ f7 h: a% q+ e
% J) O" h# {: W  @# k9 q}
2 j5 R9 w0 ^1 k: zelse if (document.layers){- Q2 U) o* U5 o6 K
if (ns_marquee.left>(actualwidth*(-1)+8))
" M5 j! W" R( O# Q1 L: D2 z" f* uns_marquee.left-=copyspeed
% z& [! \% N- L/ E( relse
9 ]8 J3 ~- `9 p, ]9 ?ns_marquee.left=marqueewidth+8
! P* |/ a& {) d, T& ]}
$ K6 B& {0 {6 L% ?. @, \}
4 _3 z6 A: C$ b" N9 V; ?+ R; B# N( T8 j: M4 ?! M9 v
if (iedom||document.layers){
' f% }. d; c* \with (document){
1 b$ j5 H7 x% B6 A7 i2 Y$ cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 S+ J4 V" x- [8 w& a
if (iedom){  {7 v3 s# g5 R4 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 D+ Q& {) E3 a6 F( A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 f) D8 c$ S+ r) _/ r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): K& d1 D9 I, O8 Y( ~6 K& @; [
write('</div>')) q6 R% O" K% ^: [
}, f& z2 V1 X; Z) }0 P' ~) Y, \
else if (document.layers){8 l# H; ^& G6 J3 H7 ]5 M# o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  z( a; g) _  v6 m/ j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% r! g3 E0 ~( Z, j1 y
write('</ilayer>')
5 x2 \+ {9 x1 f5 B}! n% o' |% h/ i
document.write('</td></table>')- Q" x2 V# ~7 L7 k3 |
}
* G: Q* D( M8 S* @  G& [2 z& h) Y}- g9 a' \1 r/ ^7 ?( |' G
</script>

返回列表
【捌玖网络】已经运行: