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

|
网页之跑马灯文字特效
//修改宽度
4 X3 T) ?: U3 ~* bvar marqueewidth=300
$ {/ Z) [0 K e1 ]) I% J//高度
$ |0 W7 b0 P) ~, Uvar marqueeheight=250 l Q y4 I6 ?1 U4 o: N( J
//速度(1-10)
) f" d, O6 {4 pvar marqueespeed=3! @. Z0 e ?/ M0 x
//背景颜色
' w$ d z% a4 ] B0 F; f X; dvar marqueebgcolor="#FFFFFF"3 n( K: L1 Z# K" H
//是否能暂停 (0=no. 1=yes)? u! Q" w. X, p* v
var pauseit=1
+ C/ B) y/ u, ~7 v6 S1 l! X' a/ g
//修改显示内容* q- F! W; }" ~" @6 m L% [3 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 p" _, W+ M! ?4 K1 r4 ~. M4 L: @$ Z1 e
( c- L9 q) k1 z8 O; o
////下面不需改变////////////
, L6 b% K/ x3 m; x p9 d6 y4 e' A7 _5 ^4 l" i7 \" [7 Q
var copyspeed=marqueespeed8 k) l- |7 |. N V6 R/ e
var pausespeed=(pauseit==0)? copyspeed: 09 \4 f7 |' }* b7 o; b2 R
var iedom=document.all||document.getElementById
2 u7 w' {$ n" T" n, \2 ~1 Rif (iedom) g' }2 k& H4 @3 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) ^8 e9 `% s! j N8 m
var actualwidth=''$ D7 F% f5 Y) D s9 f
var cross_marquee, ns_marquee
9 k. H% n# D( V1 H$ J3 a- O1 t) ?9 P6 R2 X* O
function populate(){
) `; |9 U0 f( s+ I5 fif (iedom){
, p4 l4 X8 P' h2 Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ s6 P- l( S( m$ }6 @# ~1 _
cross_marquee.style.left=marqueewidth+8
* p3 s* v" w+ r9 ycross_marquee.innerHTML=marqueecontent4 P+ h2 T) ?- ` q( V U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! M i7 h' z+ _/ [
}
1 _6 c1 x& C/ P: ~1 [else if (document.layers){+ g% z' u7 e4 c9 U3 J
ns_marquee=document.ns_marquee.document.ns_marquee2
+ K$ w9 }4 C7 L+ T7 ?1 ]) ]! M: Mns_marquee.left=marqueewidth+8( i' Q9 R: R2 b8 `$ c
ns_marquee.document.write(marqueecontent)7 B9 P: v9 b' h0 x, e* o
ns_marquee.document.close()' @( m+ p1 {+ Q; m+ d. }+ v
actualwidth=ns_marquee.document.width$ w+ {5 q% \6 e
}# G0 Y$ A; o5 g+ z7 [
lefttime=setInterval("scrollmarquee()",20) i7 L3 ?, n3 I6 C9 o7 O! V
}8 S% l% [) o& \. K1 P, l
window.onload=populate( s" m& u2 p! E2 Y8 |
: o! k/ ]( Q% {) I
function scrollmarquee(){
. ?1 A" x" m* W5 q# G+ jif (iedom){" F7 R) A6 |- M( O& L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
N! f$ ^0 F/ k' j: Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 {3 w; I9 o2 N
else
+ W+ V; c: D2 Z. H& A: h5 J: L: ~cross_marquee.style.left=marqueewidth+8
& ]3 O- u" X2 n: H* Z3 a6 `# l6 R# q! b' |
}: C+ W" z# I# r$ M4 R
else if (document.layers){% s1 h1 k1 d1 A
if (ns_marquee.left>(actualwidth*(-1)+8))
3 N3 m4 k7 l( a% l/ K0 Nns_marquee.left-=copyspeed
% y3 x8 \. U: w) K/ Melse: E2 p4 k$ G+ N- h- [( S+ B
ns_marquee.left=marqueewidth+8/ B- J9 `! W5 W% o8 ^! V' t2 P# h
}' Q" I. E6 b7 O: P/ c7 ~5 `
}. k2 B* f0 p% P% q
( G7 v: s+ Z# [& w. R# a& A @- Gif (iedom||document.layers){
- j+ _2 o. G& awith (document){; \5 O R& @$ N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 Z3 y3 | p, W
if (iedom){( c; J+ f& ?* }! [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# q4 B) I" r7 U/ `/ X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 E* N; v- v+ F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 m( X1 F" g0 C" M
write('</div>')
/ F \/ N/ ]7 n% K8 R% J6 o# [}& y7 F1 V% {' w4 U# w5 x5 p. V9 h5 c; z
else if (document.layers){
' F% p2 P5 E+ h: v) Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& v6 `0 S+ V5 A1 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ r- \8 T, b4 T3 G. h1 l3 swrite('</ilayer>'), O7 I9 \9 O3 {" A- _
}
7 L4 L& |% Q5 M, T2 W- `1 d0 E0 Cdocument.write('</td></table>'): Z; V/ \. G( n6 p4 Q! g
}! o: ?( p9 k: K2 G' x. D6 L
}
" f+ j T f/ ~, b Y; U</script> |
|