返回列表 发帖

网页之跑马灯文字特效

//修改宽度: h. r! w. J# F- q  H' {& C
var marqueewidth=300- \+ Q, Y6 e+ ]' [& U
//高度; `, \/ ^" p6 \# k- ^
var marqueeheight=250 P9 H7 [! x$ Y: `9 n8 _+ Y
//速度(1-10)
! n4 b" L% R7 tvar marqueespeed=37 i; P  a  w; i0 j
//背景颜色
& |8 P6 S# i# C1 ^! l) mvar marqueebgcolor="#FFFFFF"* T. {) ^8 A$ V' W
//是否能暂停 (0=no. 1=yes)?" H+ a5 N; g, J. l$ O+ {6 f
var pauseit=1
  ^1 f7 x+ u' J% b8 p( A
- \0 L4 d' B8 A//修改显示内容: N- i+ B. T7 z0 k: r! q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 B& }! {; q- @

2 _3 f- G& R: c; ]# `7 V% r9 y" Y8 ?
////下面不需改变////////////
4 S' D6 [5 }. O: s# l) J2 D, m1 b9 @/ ^6 r! C, g
var copyspeed=marqueespeed
5 \/ T0 {% s" J  u! `, b- S0 `var pausespeed=(pauseit==0)? copyspeed: 0
4 [8 `0 U1 S0 R% avar iedom=document.all||document.getElementById
. c. S7 \# ~+ h+ l( J0 m$ dif (iedom)
0 }% O  A$ P9 W, x( Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; x% i5 I( C, Tvar actualwidth=''
7 [2 E/ J2 ~0 E; p$ l4 w8 v/ avar cross_marquee, ns_marquee  L7 V2 y/ t) q: a

& d9 h0 a: H4 @function populate(){' Y+ N+ F6 B- v6 z# m
if (iedom){
# N6 ?1 S0 |$ J/ rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 V  T2 q% b3 b4 C
cross_marquee.style.left=marqueewidth+8
+ x) S/ R0 I/ D( g0 Kcross_marquee.innerHTML=marqueecontent
! T+ W! ]/ k, cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& w4 m: u8 b! @}
$ b; D2 S2 t. felse if (document.layers){
1 J2 A" G& Z9 r. s$ ]$ Hns_marquee=document.ns_marquee.document.ns_marquee2
6 O8 d3 }; @" B) bns_marquee.left=marqueewidth+8/ E  f0 D* a* O" x4 Q! q# C
ns_marquee.document.write(marqueecontent)2 a; k7 e" j( j" [) {
ns_marquee.document.close()
4 |8 e# C5 K8 P3 h; Qactualwidth=ns_marquee.document.width
5 B+ v# w, m# S  f, O}- z% G9 H1 J/ H- a2 Q
lefttime=setInterval("scrollmarquee()",20)
: v6 {, ?  z( X/ k. p& r. Y1 b2 d}8 c1 z+ ?) j- i* M' `
window.onload=populate
' J& _) v% W2 [) u$ I
  b* y  N# n' g4 h( ~7 i) Mfunction scrollmarquee(){  E- L% V8 d6 k  B) e
if (iedom){. q- q5 I4 k9 W/ z( w' @8 R. E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. r6 {0 O$ Y, ^; t& ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- a9 d- H5 i; S/ S' ^& O7 Nelse
/ U* h& B2 L: fcross_marquee.style.left=marqueewidth+8
( E* r7 |4 H" \0 h/ q: F# w; \- ?4 r7 B; N
}
* _+ k. }, @" C- Oelse if (document.layers){# S/ P- ~% V' I/ ^2 L
if (ns_marquee.left>(actualwidth*(-1)+8))
/ m+ s- k6 t  `7 M% l) S+ ^1 vns_marquee.left-=copyspeed$ F0 @8 S1 b: l* B, R9 O
else) ~2 f6 c/ r- D4 e. H
ns_marquee.left=marqueewidth+88 e: p4 K4 Q3 t$ j! C: l8 o+ `
}
1 h* y# D" B7 e}3 R' `, ~5 m0 I4 g8 y+ a  [

( p8 U! n& o  \# Z4 |4 Uif (iedom||document.layers){8 p' w$ A2 [& \% m7 ?
with (document){) Z2 n$ m9 Q$ l1 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 O; D: g) G- \; ~% H; F3 B6 Bif (iedom){$ j1 F' b. o; {5 A7 y9 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% E" B6 r2 m4 ^, _. Z0 G& Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 q$ }$ ^: j5 o- D6 n2 L7 J/ Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ T7 e1 ~- r7 s8 X; n8 \$ nwrite('</div>')
0 x* G( s  N& Z6 g3 d}7 @+ D) E' g0 _! S
else if (document.layers){
" T7 c* ^( B+ \% \) `* Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% S, p7 w9 r! C2 j* M5 Z3 J$ Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  j0 M/ m# m5 |write('</ilayer>')# D" K* T5 X& d8 W+ \7 d
}1 Y, T1 v: @/ M# G4 ^, d1 T
document.write('</td></table>')
/ ~4 }* C1 ?) a9 _; {8 R, `+ _9 {}
1 K9 n' X" j6 p% h}
% {/ E' z5 A) M( Q9 q9 d" a) i: R( @</script>

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