返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 }  I4 v1 t2 T' y: a
var marqueewidth=300
6 l1 ?$ v6 Y! G- _2 X/ x//高度
& f8 ~* P; M4 S5 [var marqueeheight=25
- {) m7 c: W' Z2 M$ ^& B//速度(1-10)$ M/ L3 [2 O( n; U5 L3 J$ b9 j0 S
var marqueespeed=3! P' {/ U+ \1 ]; z" R
//背景颜色% [5 h5 t$ H1 S; `" f
var marqueebgcolor="#FFFFFF") e2 f2 f8 o3 I: W7 C6 C) W9 t
//是否能暂停 (0=no. 1=yes)?
% g/ y2 j" p1 ?  d0 ^/ uvar pauseit=11 U8 X- X8 A5 O; |* x
  @; F2 f0 [/ U  J3 L$ s5 A2 U
//修改显示内容
, e% t" @9 ]. E3 w+ y) ^( Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 d, H4 H, z/ }: `
) L" d3 e+ L6 c
7 e% r4 }$ Y1 J3 U' S. C////下面不需改变////////////
! L4 E5 M' a; W- H' }; M
9 [  d6 ^: C4 {var copyspeed=marqueespeed6 c3 k$ z3 K1 g/ E3 O, N9 u
var pausespeed=(pauseit==0)? copyspeed: 0
. t: J9 i% u7 k3 g, O9 W7 Tvar iedom=document.all||document.getElementById4 e7 H" l0 }3 h& k" A9 i1 d$ s" a
if (iedom)6 u( e5 {' v. G- B% P; j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  V- W! a/ [: M$ z7 P
var actualwidth=''
4 T9 F0 Z3 m' ~& b0 Evar cross_marquee, ns_marquee
. I4 p; L/ z7 q& P( j' v/ B* f9 {0 U  p5 p- v# q* ~& e
function populate(){
0 g/ Q* T8 J' \9 a+ s" m* ^if (iedom){  ~& P; H/ u* c; G3 v  m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 U9 C3 y3 u- Q* m( q# t
cross_marquee.style.left=marqueewidth+8
; a) i2 _1 {# {0 M. m- Dcross_marquee.innerHTML=marqueecontent  Q) O; G$ z+ G' }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# T3 N- Y) `6 N6 l& F4 K/ t
}
3 V8 d6 {8 k7 @0 @- melse if (document.layers){
9 }2 B/ x( E1 {4 F7 p- U; I) ]ns_marquee=document.ns_marquee.document.ns_marquee24 m+ j" M, r8 l4 A& D) s$ p
ns_marquee.left=marqueewidth+8
- Q0 F3 f! e- v. ?# z' kns_marquee.document.write(marqueecontent)' s  ~/ d. r2 s+ [3 ^+ i" R3 ?$ f  h
ns_marquee.document.close()
# [; P% B! {( d, }" ]actualwidth=ns_marquee.document.width
2 l( m/ s7 v+ y7 O9 j}
# |% x0 n" |; a- V- ?3 M5 qlefttime=setInterval("scrollmarquee()",20)( k, U$ v% R# N
}
8 f! E: O+ Z$ G+ y5 `! Nwindow.onload=populate
( Q) m4 I# u8 F$ o% ~7 p9 L8 i! `  |  n4 `& f' ~! T4 _+ U4 z; q+ E% C
function scrollmarquee(){" E' h% y  |8 N0 L7 o( C9 T
if (iedom){  E6 j9 _, c1 |5 o2 K; p; `" }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ ^( L8 |- b  \) ^& }& _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; k- Y( A0 E% y; ^) ?1 Jelse
' `& r6 l3 B8 B& l$ Icross_marquee.style.left=marqueewidth+8, ^5 k9 F# u, g4 u7 a; P

9 I& A2 l$ ]# @" |+ ^" Z}
. c/ D% `, o  S, s! s3 c. Relse if (document.layers){
9 t  \* t. B" U# Uif (ns_marquee.left>(actualwidth*(-1)+8))0 x+ O$ j9 r6 y
ns_marquee.left-=copyspeed2 U( Y1 `% t' Z8 B0 u+ D
else5 R# m2 Y0 b, h. J+ B
ns_marquee.left=marqueewidth+8* q9 ?, a5 B% S9 \* X4 b: K
}
) ?+ A+ E9 S* N; ]# u, h/ u9 d. y}
2 i, G/ {: p$ a( W4 }; U+ ]1 K1 M7 f. K* e+ r8 Q1 d
if (iedom||document.layers){  W0 s, \; P/ a& g
with (document){% o& [4 w1 A% [7 w+ W' |1 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; _) f) ^" s4 _! x$ jif (iedom){
- W+ @! J& o* V- H4 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 u3 }1 L( E+ S) ^7 Q3 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' y1 A6 s$ k' O6 h9 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 T2 c! w4 ^3 G, |write('</div>')
1 U7 f$ a+ E1 v: l+ _, B5 b: S. T( s}0 e% T3 ]) [! C% j. d) ?" s3 _
else if (document.layers){
- x# z" l8 e8 U! nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% y, O. \( \9 C5 Y' _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' i0 N* h9 e- D, `( q4 f  _& H
write('</ilayer>')/ ^5 O% Z. }- s" W4 k3 _& W; H
}, l$ g* m) w& o$ |
document.write('</td></table>')6 \8 T5 o+ [# }2 X0 z
}* J! ]9 S; A( U1 J1 f
}
% d- V; Y  B8 A8 M" z; d% \! u</script>

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