返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 k! P3 i3 O0 @3 Tvar marqueewidth=300) H; I$ V' H* H0 ~  Z; \
//高度
5 A: b! W. c+ B- Q/ z$ fvar marqueeheight=25/ L; l" q% w) f
//速度(1-10)0 G0 w' a- o+ B( U$ Z" x! ^8 N- P
var marqueespeed=3+ V+ K, n$ H" q" Y
//背景颜色
, m; L' {7 s8 M* u# Wvar marqueebgcolor="#FFFFFF"( y5 r: O$ I7 |5 ]
//是否能暂停 (0=no. 1=yes)?
4 E2 i' A1 t% O9 kvar pauseit=17 p. m; {- I+ h- v. k9 h: v

# g8 g& z& a  B7 T//修改显示内容$ ^6 {0 _* F& _6 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ y; W6 b# g; f  i- Q
) q9 W+ I( j4 w3 H

" Q' m3 c4 s! C, h0 b7 }////下面不需改变////////////2 P" F# i" B) i
. E" ?; t! E* D0 ~) C
var copyspeed=marqueespeed8 V$ E+ S" H; n$ o9 l
var pausespeed=(pauseit==0)? copyspeed: 0- U5 y3 l  ~8 o1 l+ A
var iedom=document.all||document.getElementById
' c+ O: S: ~/ Rif (iedom)
' `8 X* e* K* E' s) L0 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ p( K3 @% O9 [3 b0 d! C4 h
var actualwidth=''
* c. ], Q6 s. t! U3 r; d; qvar cross_marquee, ns_marquee
7 g7 w8 b# s- ?' D
3 f: P- j* W5 g- @/ s; Nfunction populate(){
+ b5 ?2 E$ o) b; e7 l0 Z# [, L8 Rif (iedom){: q8 s4 Q( W' J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ A& `, v) Z' a( f
cross_marquee.style.left=marqueewidth+8
% Q/ e3 W0 i- L% s) j5 _7 ?. ^cross_marquee.innerHTML=marqueecontent
4 i" H- _0 S3 R4 N4 S/ G! dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# @$ h  {/ Z2 W- _; X}
! M( _! x5 J* B6 d9 z* T$ Q1 Velse if (document.layers){* C& u7 ^6 M) l3 T$ y
ns_marquee=document.ns_marquee.document.ns_marquee2
) P' s' H% T2 g% B  ^" Ans_marquee.left=marqueewidth+8
( e: V  Y* h% P: kns_marquee.document.write(marqueecontent)* h  b$ O! e* f) z! ]
ns_marquee.document.close()
: K, @& d$ y4 R1 o/ O! iactualwidth=ns_marquee.document.width$ \$ X( r6 t# r1 d
}9 c8 n. k8 g* L$ X" f$ q
lefttime=setInterval("scrollmarquee()",20)( J" |7 t( N- i, r  D7 H
}4 U$ q, R( r6 |* g3 y+ T$ F
window.onload=populate2 Y+ E6 {$ P  o, ~! O8 `# j; y
$ d; b, O, @# n: N
function scrollmarquee(){; V, j3 R; U3 Q4 S3 ^
if (iedom){
; g0 p" L" B+ u0 }. x+ Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 R3 M  ?8 S7 R* D; ^5 M0 [# icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ T9 o9 R$ |; k: W% `
else
5 c3 M- m0 Y1 \/ o" R* C: Y( Ocross_marquee.style.left=marqueewidth+8
2 @; f0 k7 Z' ]* S& k
; u1 D( v, ]2 \( c  b0 s' H' a2 N}/ l8 Q0 a1 Y* I3 y6 M: t8 j
else if (document.layers){
3 e! O% j' Z% E  t1 W( bif (ns_marquee.left>(actualwidth*(-1)+8))
/ j1 K/ s& L0 F8 dns_marquee.left-=copyspeed
4 c8 o+ |) l/ x% Y: Pelse
9 n, S9 F" s8 t, a3 J8 I* W% Nns_marquee.left=marqueewidth+8: z9 p6 m; i6 H
}. ?3 `3 v9 s% v: ~4 |  v
}
3 Y& Y) l3 G& O" h7 ~0 b3 H4 i0 e/ ], i$ J
if (iedom||document.layers){8 m; a+ y! @) c2 k) }/ ]$ i% I
with (document){1 W; l$ z# u! \6 @: P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( F/ @8 B7 f# S' Wif (iedom){
; j, Z! G3 Y" t: p; X# P0 o$ ^6 X+ Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* a. j! x" ^) @$ l" c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ |( d7 v2 j: nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" ]/ ^) m6 R+ M8 V6 p
write('</div>')
2 a3 H% F+ `4 F7 f0 @8 Q}
7 H1 S$ l" x6 b# Zelse if (document.layers){
- u$ x2 P) I/ Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" _' p/ _8 ^" t5 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 z1 p: o" i6 D7 ~. [write('</ilayer>')
$ P( u; L- N- A8 ]2 l) {2 @}( `/ t  [4 |5 }+ @+ U4 y" `4 S
document.write('</td></table>')
! |$ s" K& H. V& s0 ?+ T}4 w3 _: _/ A: q6 b' Q
}
- ?: |$ y4 _$ u0 w' k  [1 Z</script>

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