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

|
网页之跑马灯文字特效
//修改宽度$ a! @( p. _1 W7 A
var marqueewidth=3008 q- @5 ^$ u9 U
//高度, x1 r& S2 x( U; T8 U5 T
var marqueeheight=255 \1 Z% P0 r' A
//速度(1-10)
7 b2 n' R0 W2 u3 ]1 zvar marqueespeed=3
' o. Q' H" U: W" Q* b//背景颜色
. q+ ^( a1 ]7 k! A+ bvar marqueebgcolor="#FFFFFF"
; N) D: O, @5 ~1 l9 K//是否能暂停 (0=no. 1=yes)?# O; f8 F" B- R, e5 a/ z7 `
var pauseit=1
5 V! @0 I x" I1 t; i0 d. w
+ `7 g% _! I `8 w//修改显示内容
3 R; O5 Z8 D: Y( ?" o, X2 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" O) @/ x7 L7 I
- m p9 h$ Y6 A5 m" ~8 a
7 q5 ?* ?5 t8 |/ Y/ c3 N0 Q$ \////下面不需改变//////////// e1 v# \$ b1 e8 F7 a9 y$ ?
0 P% ?: U* @" C2 avar copyspeed=marqueespeed
9 L+ J# o" p1 y1 W V9 P8 r! fvar pausespeed=(pauseit==0)? copyspeed: 0) ~' @" s6 m3 o }+ D
var iedom=document.all||document.getElementById
+ Z: \2 l1 L, J( bif (iedom)5 F$ R4 q: ~& U# I. ?9 X3 f" g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 U: ]) f* X; H9 v$ Rvar actualwidth=''% o4 L- A/ R* q$ W2 P: u8 z# c
var cross_marquee, ns_marquee n4 N, j+ y) o# ~6 f
% k; Q" c# {0 l( j5 |+ z6 n: M
function populate(){
& |8 G: y. ~& w( J, A) zif (iedom){
+ }$ x4 t* M0 n- S2 s4 |. D4 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' w$ ^7 i1 P( Z' \cross_marquee.style.left=marqueewidth+8& M9 R6 ^% A0 T B: v! j! R
cross_marquee.innerHTML=marqueecontent
- [9 \ v e2 k! @4 H2 Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( A9 V X5 t/ G; O
}/ @( C7 _( [4 i3 e8 }
else if (document.layers){
+ K" C* [3 q$ v% u j4 bns_marquee=document.ns_marquee.document.ns_marquee2
0 r- a: C- c* b. N) ]0 o' s3 A! wns_marquee.left=marqueewidth+8
2 L0 V) z7 V. }ns_marquee.document.write(marqueecontent)( v0 M. T, n% I$ I
ns_marquee.document.close()
" i6 d" |1 V2 P0 factualwidth=ns_marquee.document.width
& x, l& {+ c( X}: e: L8 a1 N" R( {
lefttime=setInterval("scrollmarquee()",20): A5 Q8 X7 }" {, A0 s) b4 G, Y
}
+ z3 K m+ C/ l2 }; Jwindow.onload=populate
- W0 o) `! E/ ^/ Q6 Q$ X' T: r9 V, N$ L" @
function scrollmarquee(){
H7 x) i3 G; M" Tif (iedom){
2 u. X" r0 x) ]0 \7 m5 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 y# f* V7 F! ~% k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- X3 [ m; S2 X2 u. w9 n, }
else! l, J3 b( Y o
cross_marquee.style.left=marqueewidth+8' E( |) H7 B7 S8 f
4 ?$ G0 D6 z4 B9 S/ u. \. l
}# u& B7 W I# g1 y" s- J; m% t
else if (document.layers){
1 U2 ^$ `6 o/ h: O* Nif (ns_marquee.left>(actualwidth*(-1)+8))
" Y5 X* F: V5 ?) K9 T) ~: Cns_marquee.left-=copyspeed
3 S5 B6 a# O& ~$ o1 telse" p; Y3 t8 q) h9 g
ns_marquee.left=marqueewidth+8
# [' N; b, G4 ~}9 s8 a! g. _$ s+ j
} g, l. ]; E) M/ P/ U/ ]
5 D4 A* T. J x
if (iedom||document.layers){
9 J- O; o9 A# h dwith (document){+ s) W! F/ k G$ }' w$ k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); S, A' S* N- T6 V0 e2 g2 |
if (iedom){
8 E" g2 d4 r3 b7 G8 {4 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- K8 V: H" V# d% I2 ]) Z, e6 o; n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" n0 W2 e1 K8 I2 d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: P0 ?% I4 H5 }" l* u B" iwrite('</div>')" N8 o% O! [9 i6 s) D; ?2 f$ N
}
( G2 K. Z. u; y C* W* melse if (document.layers){/ |8 l3 l) E0 e; E7 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 c' \8 Z* R/ N' c/ R0 n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): x$ t- m% K$ z# |
write('</ilayer>'): [1 U. b, r6 \' d2 {
}2 @7 y1 q k8 g1 H
document.write('</td></table>')
8 D5 }1 G A" `* |6 ?, W}
# Z3 b9 \# }0 L' F$ N( y}2 m; [1 `0 F% e9 h7 }3 H* Y
</script> |
|