返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ Q. C8 b' _& E( svar marqueewidth=3007 c0 Y8 S1 i! D
//高度
% h" Y& p# m! n( e) w( _var marqueeheight=25
6 X, o2 g" Z" x: u! U//速度(1-10)
' ~! A7 x( N& Dvar marqueespeed=3
) q/ N& e+ H9 V: x/ o2 s//背景颜色# u1 p' q3 S, T, i
var marqueebgcolor="#FFFFFF"
& h: [4 e, t! P//是否能暂停 (0=no. 1=yes)?  I. B# \. r3 e
var pauseit=1
8 s. Z  u0 J2 {& K( l
' W: M- e0 s5 b$ Q//修改显示内容) A4 U+ S5 T, l9 Y6 M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ i9 T0 o( q# I7 H9 M% L

# V! e4 u& @  R. L+ ^; o1 p9 U: G, a& {; E5 Z! N- c
////下面不需改变////////////+ K' R2 z* }: A$ `8 S  j
" j) y# S7 c; G4 I5 ~4 y
var copyspeed=marqueespeed) E# B# u7 Y7 b. S1 w% S9 e" X
var pausespeed=(pauseit==0)? copyspeed: 0
( c7 G  v, a6 ]var iedom=document.all||document.getElementById* E( t+ n: R6 d% G2 ], {+ Z
if (iedom)/ r; J( Q5 I6 S1 t) u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" B  e5 T- B% z/ ovar actualwidth=''
6 n% `: w  I4 u0 F( S) `# L) Mvar cross_marquee, ns_marquee; R4 E/ A* ~( j, X. ?  V

, O$ N5 {4 x% {9 F: g( S) Xfunction populate(){" l( ]! Y  ~. |; _) k: ?3 |
if (iedom){0 o! \, j* ?. e8 d( b' t1 G' T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* b9 t7 [( H0 G
cross_marquee.style.left=marqueewidth+87 ^  G* t* v# X) P: i; }
cross_marquee.innerHTML=marqueecontent4 W9 i( R8 a6 j- n( O0 D& w# P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ _8 E5 ^6 }: g$ b3 r# j}
. r! s. h1 Z& B0 o1 A( k6 helse if (document.layers){
& C2 I: k7 l8 J( hns_marquee=document.ns_marquee.document.ns_marquee2$ E$ V7 ~5 g2 \5 A- _
ns_marquee.left=marqueewidth+82 I$ {0 S6 R3 V; C; ^
ns_marquee.document.write(marqueecontent)- r: q0 c9 b) M+ R, \; e
ns_marquee.document.close()
% k- h' I  c! @/ @/ ~/ l3 Mactualwidth=ns_marquee.document.width5 t* G" J; v- H( \
}! \( y5 b) g3 c4 ^9 K1 s
lefttime=setInterval("scrollmarquee()",20)
% D& |, B: K) k: c  L7 w}
' G7 s6 _/ j, g$ q* kwindow.onload=populate
% Y! F: `3 l2 |* P1 K
/ [3 v4 B% G+ N- `" V) {function scrollmarquee(){
' ]% h& C4 g0 B2 Gif (iedom){
: r! P7 M. m. E' n8 Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 t& |' a7 |* J8 r, scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; m8 T9 i. J  }! u; A3 I% n
else
; l8 i2 k+ n7 `8 b: \- @cross_marquee.style.left=marqueewidth+82 _/ A* @! C( y5 M
- F$ `1 V& D, e% H: z! q+ r3 }
}0 `) V* s: }# M) J2 Y: R
else if (document.layers){
$ n. C5 V0 C# Wif (ns_marquee.left>(actualwidth*(-1)+8))' @7 L2 x7 g; w5 A2 u" S* y
ns_marquee.left-=copyspeed
4 d5 R  O! U! O2 Kelse1 c6 I( ~& a- Q  Q9 \9 S/ |% W2 h
ns_marquee.left=marqueewidth+8
% p& m+ h1 u" {: j}
" x% T2 p! R1 X}/ q# w; E( K# K% V" m# W1 k2 F0 s

* ~8 L! _4 A0 S. K0 x! gif (iedom||document.layers){  i" Y# i* ~/ G0 U# G" c, v: T) H
with (document){
8 f& k" e" M! @+ p7 Y( l6 `% qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% X1 W3 d8 r' \# X* Cif (iedom){
: O8 s0 C- e" f9 a4 h# lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& Q8 }5 U. f7 b& x# dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- R) W) Y+ c& u6 jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 t* k7 H1 `& j9 t& g# S* U& Jwrite('</div>')
; O' f# y! s6 O}* }8 z+ k" l! A7 r$ a
else if (document.layers){) R7 Q' U' V$ M/ t* ?: w$ S/ C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" b/ |$ y7 U* J! L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( R" |  ~9 {8 H0 u% n- c
write('</ilayer>')0 |  o. |, o! ]6 J' X' z; Q8 H
}
% |" U- i/ u: R4 t* b; b, s! ~2 wdocument.write('</td></table>')
% @# V" ]4 c7 i8 ~3 b# h. f. f}" H4 q) C( e8 y
}$ D# @2 s- ?0 h- {5 g' E9 X$ C+ S0 O! S
</script>

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