返回列表 发帖

网页之跑马灯文字特效

//修改宽度  p9 L9 a. a) t& g5 V/ F
var marqueewidth=300
: J4 \& w9 J0 U: H# P) Q$ v//高度
- G( ^7 A. _5 q7 pvar marqueeheight=25
1 J$ ?- S! K7 x  j- V//速度(1-10)
7 y4 _8 X! R2 q" U4 {var marqueespeed=3
, T. s2 g7 W$ [9 w//背景颜色* r. a2 C- {; W% }3 b
var marqueebgcolor="#FFFFFF"; Q' ?* Z) H( r* l+ h# w9 s
//是否能暂停 (0=no. 1=yes)?$ m$ K# {1 j# N4 l( e9 c/ e3 [4 M
var pauseit=1. v3 @8 U1 e4 m! T# T- D

8 R2 a2 w3 V0 o4 G//修改显示内容2 `( o" i+ v5 a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ u1 f: S% U" d2 J

+ ~. f, g3 I: ]9 o4 i" v9 @2 ?
6 j- M( X- p( r5 E) S////下面不需改变////////////
: q# V( B% ]6 ?$ q, K5 O0 _8 D% X! @$ k: y* x, X4 r- |
var copyspeed=marqueespeed
8 v3 O  _; a* s! ]9 q3 v  W! Dvar pausespeed=(pauseit==0)? copyspeed: 0
- z' M- I, J: g4 L; rvar iedom=document.all||document.getElementById* F/ K# F. R' e7 c
if (iedom)
! z- h' H8 @& k+ T" J  {% `0 N; Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 U% ^/ {& J' K8 v# G' s' avar actualwidth=''8 B3 q& ]. G( K9 N; O
var cross_marquee, ns_marquee9 n  R9 x2 E" G$ w) K7 q5 S

7 L: V. L) K( e# J8 S& P7 l# Ofunction populate(){" l2 q8 ~6 a" I0 J+ D/ v
if (iedom){
! S' J: I! t2 s3 C7 B: @0 J5 ]1 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ m; q; E, D) {8 h& G) \- _2 U% A+ Ucross_marquee.style.left=marqueewidth+8
9 L# v! t7 p8 Y8 }cross_marquee.innerHTML=marqueecontent
# F' }! M; P; Y- I8 N4 c8 `' iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# Z' ^" P2 F  c! y}
3 r: ^: n: R3 W: ~" s% Selse if (document.layers){
, Z) y( `: e3 F( B* [" H8 wns_marquee=document.ns_marquee.document.ns_marquee23 u0 i7 b7 q- C$ T$ z. y+ x
ns_marquee.left=marqueewidth+80 k2 S7 w! k$ k5 k1 M
ns_marquee.document.write(marqueecontent)$ Y: S7 ]+ x: n  ?2 G6 [7 n9 B
ns_marquee.document.close()4 C/ g% e* q" s& |0 J- q
actualwidth=ns_marquee.document.width
) l0 R+ W& V- `}* f/ q! d) F& V' J9 b5 o/ ~  l
lefttime=setInterval("scrollmarquee()",20)
' e1 i1 @/ j1 w, h4 A}
4 O2 p8 P7 B  d6 _window.onload=populate$ Q# \, s5 Z/ L
* C, u, n* v3 Y% Y' ]
function scrollmarquee(){
: o3 J5 v/ J, s; Q: Oif (iedom){
/ b! z! b# w4 xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); v3 _- x0 {" ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  P7 A4 F9 X8 Q* K6 ]8 M" R
else
- C# U2 ]* Q- }0 }cross_marquee.style.left=marqueewidth+8
5 h. M! ?9 k6 Z" c2 Z, Z
3 P; J# P$ b/ u}' _  u+ H! x' r) x) E. o
else if (document.layers){
5 i; ?& s, U4 ^) _4 k9 E% L2 ?4 |. Eif (ns_marquee.left>(actualwidth*(-1)+8))
' K) Y- z* v$ ~+ A) V" O# E+ m' \ns_marquee.left-=copyspeed
' [! s/ O8 F3 K( {$ ]6 ^else
, g* y8 I. A6 u4 Ens_marquee.left=marqueewidth+8! s8 e) `6 e( G/ |
}
8 b& {& w: \0 y7 i' v1 w) R}
7 [+ }# |! n$ U# a1 d/ k
6 _' m6 q/ L4 ?  _4 M; t$ q# y3 Y! lif (iedom||document.layers){3 ?( Y( O4 _, M2 H* g
with (document){
7 ]' x7 k; k8 t  Y8 c% \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& a' V& s& V. R
if (iedom){
; w5 ?& X+ W8 f7 f6 u% dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ a) X& Z" e- f- M5 q2 y! h* W$ G+ B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 f( L7 n; s) m. Y- ]4 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; L7 e" C% P9 s2 q+ f, G4 T- f: uwrite('</div>')
' _5 @3 l/ u, B; D( `}& M. f) L9 q5 Q! H
else if (document.layers){
/ o4 _. W( s5 M7 R/ ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! r2 T: I  L5 ]6 u( c- @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 ]- @. ?0 f% n/ a! c  T) Mwrite('</ilayer>')
; }/ _7 `9 X) D2 X8 U}
" m3 q: Y, A: x/ c  G$ k! Fdocument.write('</td></table>'): z* u% N* K! o
}4 N& e* V3 ~+ w
}& z2 p# A: B4 z2 }8 J2 |
</script>

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