获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 s" d) j: f' Q* d3 J( B# l! l6 z/ E, xvar marqueewidth=300% Q  d! `4 |& O$ p% W5 s
//高度4 O8 x; d2 J; ^) t2 F* G0 V7 v9 W. L
var marqueeheight=25: B4 [2 ^! O! A# A7 U5 A* b
//速度(1-10)
0 x& h+ O( S4 C1 mvar marqueespeed=3; g* K" A+ W" n" L1 S' y
//背景颜色
" K  P# c- y. G6 Lvar marqueebgcolor="#FFFFFF"1 w. X4 u6 M3 ]% l' b
//是否能暂停 (0=no. 1=yes)?
, Q2 C+ b7 O$ A* z! l! svar pauseit=1
0 V9 Y# `% _5 r( x4 K2 x
" r# i) d( @9 ?. T- |, u//修改显示内容! `! ~" C. m/ n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 l. z' H) @" K; b3 M& J0 c  l' W4 j/ x. f
  i3 C9 W2 H2 P& W1 `
////下面不需改变////////////
" M9 _+ Y; `) L
# `. V# ^3 j, p, Wvar copyspeed=marqueespeed0 t# u* t+ E5 H3 a" Y$ `
var pausespeed=(pauseit==0)? copyspeed: 01 b, |+ L! A/ U: d
var iedom=document.all||document.getElementById
8 |4 p0 z1 k: Y+ {8 e. Bif (iedom)
2 J- p) Y. ^! W! I9 {% @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 h$ |. b  G/ _* L3 n) z9 T, H/ Cvar actualwidth=''
) n) s2 y7 X, }var cross_marquee, ns_marquee/ X2 N: L# a% L- e8 i  v. ^

/ l% u$ G8 N7 R) @, qfunction populate(){
" D+ \6 n; p. V- `% gif (iedom){$ y8 {; q& p5 M8 N& d, J' w4 T% _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 |7 d( z6 r  e" h9 Q3 Across_marquee.style.left=marqueewidth+80 J3 }& a/ S) y2 L. C
cross_marquee.innerHTML=marqueecontent
1 \3 D4 y! x0 A* Q7 i, i$ gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! v3 }  f! M  ^; r}( S* `  q( M4 c/ h) N- l- j9 d
else if (document.layers){
  @* g& m; W* R7 d& \ns_marquee=document.ns_marquee.document.ns_marquee2  k) Q6 q( i5 {  ]6 b
ns_marquee.left=marqueewidth+8) z  `0 n- F9 y- Q% j
ns_marquee.document.write(marqueecontent)4 \1 ^1 X" ]  E2 J6 w) q, U
ns_marquee.document.close()2 _$ R/ v% I: ]1 L) u1 u
actualwidth=ns_marquee.document.width
, m: `& o2 @6 G( l9 n}* p. [! D/ K; K- a) J0 A
lefttime=setInterval("scrollmarquee()",20)
0 U/ E6 O7 p% ~1 J5 g9 z( k}
  g; \% _4 C6 ^8 ^3 Fwindow.onload=populate
& K* x* ]3 Q7 K0 s  G) M' a& \* e4 u# _- l
function scrollmarquee(){# z+ Z' V* Q+ Q6 r) p$ J3 r
if (iedom){
$ e: ^% K4 l3 uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, D( J  g. \0 H& ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' V% a3 W. M# j2 h
else
1 d  Y0 \" k9 ]# S1 C8 i7 J# Ncross_marquee.style.left=marqueewidth+8; l2 \! U2 Y  B6 I5 ~
" J' Q1 I, v5 S" U/ ^0 r
}
3 ?; {& b; e. k% e5 b3 Yelse if (document.layers){6 x" L+ ]- x9 f% n
if (ns_marquee.left>(actualwidth*(-1)+8))0 l  q9 h/ J% Y7 F& X
ns_marquee.left-=copyspeed
# B" X; v( L6 i5 i4 Aelse+ m7 D9 c1 Y: }# c! j' G
ns_marquee.left=marqueewidth+8" C" Q; X( P; A- {6 Q# k% `
}$ J" s9 g* m: D1 i! k2 e% Z
}
$ s% T+ a( v+ U- j0 l2 A- d8 m+ {. `* ?0 m" \+ ]6 }
if (iedom||document.layers){
& j% ]% L$ ]- J- j' H8 fwith (document){6 h: q  e! i# C# p8 D7 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 e5 W6 N6 X$ i9 aif (iedom){
! m) k) r, y8 c' Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' `- S  ]3 x4 [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 h9 i# b" b6 j4 [' j) uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- m5 {5 r$ E/ g! M: p
write('</div>')& K3 f, \" S' A( Z
}  E$ G2 q1 ]2 z/ @7 b& x  G* z
else if (document.layers){
# p# O& h7 k* G  {5 kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 S$ O% w( l  t* o8 Rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ P6 `7 w7 n% V: C$ z! Swrite('</ilayer>')7 |2 W. [, K6 X5 b) M- e
}6 L, y" @- m# L5 T7 v3 m' @
document.write('</td></table>')
- e( r# H/ b% D0 o& }+ Q}. r* S! j# u. K0 d  `# t
}
# y/ g: Z3 O4 X8 I6 Z8 d</script>

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