返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 w) W& T0 [+ A4 r0 _
var marqueewidth=3004 T) M1 Q0 `& [- z& O
//高度
  s% {% ^6 @3 c/ y. nvar marqueeheight=25
% D8 O1 k% W, F6 W& s, S8 D# T//速度(1-10)
8 q- G6 u  v# d+ E  mvar marqueespeed=3
2 N- y" m; l: T//背景颜色
7 E/ ^, p1 r( P9 rvar marqueebgcolor="#FFFFFF") A/ Y$ c* L5 {, O3 N" V# o
//是否能暂停 (0=no. 1=yes)?: y  L& _" X5 E8 [* D- b6 l( k5 W
var pauseit=16 G9 @. D& [7 [2 D( y% O7 l7 y

* i" Y2 B+ g$ R8 S5 J' c) ]//修改显示内容* y( Z. s$ R9 x8 _6 e1 m! H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; k& x+ x/ l+ X; n5 F6 y
6 [. F; V; H. ~5 P  b1 u  i6 I6 d6 F8 `: j5 u- y
////下面不需改变////////////' J- }! D" Q4 E7 T" N
2 a. b0 k2 w% l. l/ R
var copyspeed=marqueespeed8 l# P& P, S  d6 Q" v* _; G% Q! ]
var pausespeed=(pauseit==0)? copyspeed: 0
1 E0 ?$ c- V; y4 Ovar iedom=document.all||document.getElementById
* o: W) e  P8 ~if (iedom)0 y0 v" |" O" d8 g" ?$ P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) D1 J1 G! D& v; Y! z0 L4 {var actualwidth=''* p0 b* V! z1 a& d
var cross_marquee, ns_marquee& h! q5 n, o. Q$ z. h

9 t* T! q/ r2 u0 A; s7 _6 F& [function populate(){
5 L; K, s* p) e7 p3 s; b+ K6 @" ?: jif (iedom){
  K7 o: J  ?) N" ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ l( ?. _- U- g! G
cross_marquee.style.left=marqueewidth+8
& p* C- P( {$ [) d6 x: M8 K5 J$ ccross_marquee.innerHTML=marqueecontent
$ L, F5 G7 r7 z% Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# @+ P" `( P( @
}  y0 u9 H0 _; q$ @
else if (document.layers){
) R. V5 c2 I1 E9 v& j  k6 hns_marquee=document.ns_marquee.document.ns_marquee2
1 o% Q) t7 i7 |: dns_marquee.left=marqueewidth+8
& r: O4 X$ M  I  H0 Rns_marquee.document.write(marqueecontent)
# e9 w$ \; J2 n* \* ?; v3 Vns_marquee.document.close()$ C) u- _5 y* z# o, Y
actualwidth=ns_marquee.document.width
9 [% w9 }; y3 @7 ^}5 l6 F% w3 D  x$ j# X1 B
lefttime=setInterval("scrollmarquee()",20)
% H2 G2 R5 W' t$ @( G}- f/ I% J* _  M- I. l; u
window.onload=populate
: e7 r, W! l+ w" N$ n
: P/ R! K! Z% j$ ifunction scrollmarquee(){
, s. g8 u% D  |$ @6 h7 M% Rif (iedom){+ |* i8 A% ?" `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 P# _, d- d& @9 @& Y" I8 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  l3 w& k- }9 Q0 S
else
' B6 s+ T, |# j" C  v- Gcross_marquee.style.left=marqueewidth+8
* U3 q% P) j% d1 h% G, @# j' S& D
+ u5 d5 s% ]* s- f3 l9 I}
. F# `8 x2 K8 P# ?, M5 r* zelse if (document.layers){
1 y. U5 X8 l; v& v9 Bif (ns_marquee.left>(actualwidth*(-1)+8))
( a# |* O) o; {# p- H5 w8 `, ?0 a9 ]ns_marquee.left-=copyspeed2 |9 _: [$ A2 C4 B
else
3 ?9 G. z! H! u1 D6 t9 ]ns_marquee.left=marqueewidth+8
1 s7 _* t% C/ b8 t- {}4 E$ y, Q/ V  z0 R. Y; L8 [
}
3 q4 w. l7 d& R+ l/ ~# J" \8 T0 F5 T9 M1 M2 b2 o/ a4 J
if (iedom||document.layers){
7 d8 T/ h' @2 w) z% r8 h2 ~with (document){
7 l  _2 z3 L2 T# ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: q, B2 V* i0 N3 w! i+ `8 b, h# r1 Iif (iedom){2 b- `' A3 i" m& y& l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); U0 g0 O* H- D9 @2 ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 o( S. }; S& l% W  }' H0 {: O% bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 ^2 B3 |: M9 c; V9 i& q
write('</div>')6 A3 D6 w9 q+ f0 I6 U
}
$ t1 ?4 I+ I" N0 Q# I$ z& D( \else if (document.layers){, m3 D! R* @) U8 x# v: A0 Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 s4 r9 B3 @" B1 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 W: a: q4 M6 nwrite('</ilayer>')
0 Q# Y- a" u# l7 J& w}
, k0 e' M9 D; pdocument.write('</td></table>')# P  r7 h! u3 a9 a- ~/ N
}
3 C0 e" V5 [4 @8 U' l) b}
) o9 H; I5 r: b* c</script>

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