|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
- f/ ]; _' s- K" R+ F! `var marqueewidth=300
1 R3 G# x0 x) v" |$ G* M//高度
' n7 d% O" \1 k: t' D2 p/ l5 W) Ivar marqueeheight=25+ T; l4 u0 c9 G- i8 h# l$ v1 }
//速度(1-10)3 q% r1 x5 ?' C7 N# g! F
var marqueespeed=3
" a2 V X% C' v; {1 {//背景颜色
^6 p: Q; r" M: Z6 y# jvar marqueebgcolor="#FFFFFF"
' o' |& L3 O( t4 N//是否能暂停 (0=no. 1=yes)? U' k+ ?) D# Y" z; g1 _7 k
var pauseit=1: c; ~4 E2 |3 p; k. b3 f7 l' j
8 d& P; f( T- q6 Z- H' j7 @% H//修改显示内容2 |3 V1 ?* J6 P: a5 E% L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 S4 i, j5 g4 c" ]
# a( [5 u; z( a( ^% C3 b ^ A7 R8 H- W+ R- ]4 U
////下面不需改变////////////% j! U% ?! w& R
% w4 _4 `4 j& Y+ e; y/ \7 g- L% }var copyspeed=marqueespeed
5 x/ [% V0 s) A/ b G- X$ rvar pausespeed=(pauseit==0)? copyspeed: 09 j* Q- ^, m/ K( M
var iedom=document.all||document.getElementById
9 X; m. Z8 D" [, t/ [if (iedom)
$ S+ w; P+ f+ J4 d6 a) p, Q; c. ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) K$ s5 h* M" svar actualwidth=''
% ~2 H( y5 H, |, Q3 P+ C$ wvar cross_marquee, ns_marquee$ l6 |' {# g# M4 B- z' p7 p
0 g4 m7 G8 m6 J6 b' ~function populate(){+ z. ]2 I9 y& y) e
if (iedom){
0 s" Q$ N8 I6 a3 f7 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: \4 C! [* M5 j% }3 ?cross_marquee.style.left=marqueewidth+88 P3 m& c* Q8 n4 f) R
cross_marquee.innerHTML=marqueecontent
& I: u" H' ^3 K3 k3 n8 A3 x; Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ _+ B& V9 ~! y0 R, ?
}' E6 b! Z; w2 j! ^. o* {" A+ L8 W
else if (document.layers){
8 G* }, d1 \8 t! S; t/ Hns_marquee=document.ns_marquee.document.ns_marquee28 w; l/ F. q0 L" R( h
ns_marquee.left=marqueewidth+8 k+ B5 E% S& T4 J( I& B* L
ns_marquee.document.write(marqueecontent)# [8 r& O. p& d! s( W6 ]) k
ns_marquee.document.close()
% ?/ z% P y! Y) P+ d7 e) bactualwidth=ns_marquee.document.width1 s& g# p4 w+ W* r
}4 i& m2 l$ _8 |9 w
lefttime=setInterval("scrollmarquee()",20)
! v& v: Y- ]: q/ e4 Q. ^}
5 m" \7 h& S9 Lwindow.onload=populate
) t% g- t- B5 {# n# K* d. q1 q! r( j, l1 E
function scrollmarquee(){9 D! U; y, O2 i6 P. v8 a& y; U( X
if (iedom){, z1 L6 c# X$ b, e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& n6 V0 }* l1 I7 ?5 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 ]0 }7 e7 I% j' q0 B/ U6 j& welse
5 |+ |- n% ~# M+ C; W* e5 Z7 Wcross_marquee.style.left=marqueewidth+87 @+ s# L# ~7 ?+ ?& L& v: M
/ ~, c; Y) n/ D' X
}
/ {' N1 ]' L8 _! z( \else if (document.layers){4 p, d4 L5 M+ m3 h& j, ]
if (ns_marquee.left>(actualwidth*(-1)+8))9 | m" b& }1 D. Q: ~
ns_marquee.left-=copyspeed6 U3 |( d+ q- R: v5 a
else
5 h/ L- |" D! dns_marquee.left=marqueewidth+82 s. k' _5 H9 h1 B/ S, S# u
}
# J7 |# k- V4 y4 K: C z5 d}
3 k% t* \6 s* j; ~8 D, N
" Y' J, a, G: u# Cif (iedom||document.layers){
+ {; K) q+ _- O1 H( U# Dwith (document){6 u \1 z" S- V# K! M* W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- ?/ H: q/ L: \6 y
if (iedom){1 a2 s! w% N' x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ s; v+ [$ n2 u3 C) Y* x T- [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 u/ \- h* c3 V2 J4 u$ e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' X( \& h- C# Ywrite('</div>')3 z6 {2 h% n" R# d8 v
}3 x: H4 V3 `9 K: i$ E5 I
else if (document.layers){
. R( ]2 m: d7 w3 ]! d3 H4 R6 A' Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& _+ x7 \. X3 Y5 |+ d7 u$ p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 Y8 l+ w4 Z0 G: d4 @7 p. Z
write('</ilayer>'): w2 _! a+ S6 q7 ~
}
; ?* }# M( P5 m- A* l% Zdocument.write('</td></table>')& M% b; ~) G# H( \; j
}
( w, i" `) f7 G' r, T0 H. h}
' E3 e6 Y' C" B: ~8 g</script> |
|