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

|
网页之跑马灯文字特效
//修改宽度
" p7 D2 ?" N9 T* C* lvar marqueewidth=300! ?* K# G/ w, `( b& `, [
//高度
7 n6 U/ I! P# Y1 l0 Z2 C1 Rvar marqueeheight=25
+ L# m+ w* s9 O3 Z4 v5 L) {//速度(1-10)
) W1 b# V2 M* S Z" S H8 xvar marqueespeed=3% h+ h* g6 M R3 a- S
//背景颜色' U- Y% q& ^* P" o: j6 C
var marqueebgcolor="#FFFFFF"
5 s0 U+ b7 E" q: @//是否能暂停 (0=no. 1=yes)?( I& ?% ]0 j# @( R* n, w
var pauseit=1" i$ G ?1 D. \6 Y
3 g# T& G9 A5 S- B% \
//修改显示内容
` n1 ?% ?- R, ^) U5 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' p6 Z' B2 }9 c' K3 Y4 M) n' ]" r: q* k8 }$ ~
, |9 a3 P9 E8 C
////下面不需改变////////////( r& a' x* Q! n' Y& \$ `) o
+ b' e+ F4 R6 d% |" z* ]0 U( Fvar copyspeed=marqueespeed
: Q! g2 P2 ?$ ~var pausespeed=(pauseit==0)? copyspeed: 0
# W+ I9 ~. f) y% a+ U8 z+ K, ]var iedom=document.all||document.getElementById) z: ^5 t x- O- Q- }: c6 Y
if (iedom)' c" V7 p+ s6 @+ t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 Q7 T# l8 |4 E2 k: v* d% I m+ gvar actualwidth='') l9 u+ q$ [* o: x4 ~5 l6 J
var cross_marquee, ns_marquee2 A" X; T# J. `& F5 j
7 V% f- @- `; V; L
function populate(){9 y9 G8 W/ E! t* F
if (iedom){
8 {) ]3 J% d; ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee M/ _6 C: Y& {) b t/ F2 U
cross_marquee.style.left=marqueewidth+8
( c0 M0 n7 A$ X- O2 o8 B' _cross_marquee.innerHTML=marqueecontent
# ]( q& K' `$ A6 c% E0 Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ j) v7 T0 {8 w+ i% W8 `}
5 L3 E( C' y! ` o2 a' celse if (document.layers){
7 n5 W; ~! `; P# \4 G. ans_marquee=document.ns_marquee.document.ns_marquee2
! `6 u& {8 h, t5 [% [ns_marquee.left=marqueewidth+89 e6 C- Z# v2 w! b! B2 h
ns_marquee.document.write(marqueecontent)
M% ^. g! `( p/ ons_marquee.document.close()! E: Q( \+ w: O) K
actualwidth=ns_marquee.document.width
0 z; ^* K, R& {$ D. p} g' v. F* O+ M
lefttime=setInterval("scrollmarquee()",20)
' i: A1 v& p" Q) s5 p}: k2 y8 {- c' d r
window.onload=populate
2 O9 k1 @/ q) |0 E2 J7 O# N
6 E: a- Y* r% T1 W0 {function scrollmarquee(){4 j8 \& t! c2 z, V* F, e' ^& G
if (iedom){; ?* T$ f! @5 s, j0 d V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 S; Z4 @3 f! |& j' |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" M) n9 z, `, k6 R) F' @5 G: A
else9 v1 J* V0 {$ x; X
cross_marquee.style.left=marqueewidth+84 q! `) G9 A: a0 P
9 j1 K/ I6 K5 W5 x}! E- F$ ^1 Q6 n( E) g% X
else if (document.layers){
1 [; G7 K( A8 p _1 e. Mif (ns_marquee.left>(actualwidth*(-1)+8))
6 w2 ^+ Q+ {3 Ins_marquee.left-=copyspeed7 ` Q8 N, C/ X9 E! o6 h5 i" A
else
; a0 U1 Y8 O$ \1 ~6 @' F8 wns_marquee.left=marqueewidth+8
~$ z8 G5 V R}
1 v& l, C/ H- u6 J: j2 K}
. i% J& Q; y8 `! M
. C/ J, z' P" aif (iedom||document.layers){% w- t7 ? b' I6 o7 m% F; ^
with (document){0 [1 X7 ^6 C3 u% _9 w3 y0 v9 d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- Z* C+ M3 n2 y- W& D2 @
if (iedom){
Y, M( w; J" I- c, k; f+ S8 ]- cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ ?0 {/ H1 n# L1 Z* s" l8 Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 d3 O# O2 v5 {5 W
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 \8 q6 x4 [' `7 t" o) ]5 m" j
write('</div>')6 i1 t% S+ w) O6 f
}
! i9 B# o1 G, V0 ]else if (document.layers){" R) w( D! E: B4 Y* _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 H4 ]# V, w. _; }) ~/ Y2 X' q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 q) ]3 p. k: u% Jwrite('</ilayer>')
& [* h' F l# F) R: E}
1 b8 w) j2 _5 R- q" Fdocument.write('</td></table>')+ L: T( i/ h3 i" ?; b9 W
}
, ]) ]% C( h e4 {9 U% c# f) [; }2 L6 i}+ d% a5 h2 i1 _1 S, ~
</script> |
|