返回列表 发帖

网页之跑马灯文字特效

//修改宽度* [5 |. X/ ]; P+ h3 r
var marqueewidth=300
. ~+ b4 s) ]& H/ S5 W* j6 @//高度$ Y  [7 b" B- P3 O( \5 S5 ]" w4 p
var marqueeheight=25
$ _) ]* g) Y2 {( T. \. z6 q//速度(1-10); H$ R1 l$ |* s& n
var marqueespeed=36 |( f) ~0 q3 Y2 I) S5 r0 D
//背景颜色" @7 Q4 }% w4 I5 G
var marqueebgcolor="#FFFFFF"% l: \4 k: U0 A: Z3 \. u, G
//是否能暂停 (0=no. 1=yes)?9 A% @) T$ x* l* F  a, v( l
var pauseit=1
2 c: Y. o5 R( h* G2 {" Y$ ^% x2 {) N7 @
//修改显示内容- r4 w# d: n& Y- i9 Q% _2 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 o; Z6 U1 k! K/ N& \: W9 h1 [# L5 }4 M
  E* w8 z. ^% b
////下面不需改变////////////
' T3 ]; @5 E' b5 k# d4 o, w' s. \3 t1 d+ p; O
var copyspeed=marqueespeed
4 U) |  L3 }" j1 {7 Uvar pausespeed=(pauseit==0)? copyspeed: 0; b: }( n8 m& C# R) r5 A
var iedom=document.all||document.getElementById
. X4 O/ n! F- G( N" V- eif (iedom)1 g4 m. z1 Q- n* k/ C( b& X+ f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 O1 I6 R4 R4 A8 Svar actualwidth=''% x; M* v5 r& C2 b8 c# w
var cross_marquee, ns_marquee9 F. P7 S) _2 D, X8 u) ]- x8 X0 t1 f# ~
* C. |, Q+ I) f  I0 t. _) J
function populate(){
6 l6 |- d9 ^# P# m, P1 O1 y2 Qif (iedom){' C6 t; G1 t$ G4 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- L0 p: o; J) m, \1 ]' S9 k
cross_marquee.style.left=marqueewidth+8' n9 x; m6 R6 B' Y* B& _  U
cross_marquee.innerHTML=marqueecontent
5 w. O; X6 U) C' B6 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( a7 c& b/ e# P* G4 V5 c
}
4 c6 D. y1 b5 y4 \else if (document.layers){5 @9 m% ~9 G/ g; I; ^$ f
ns_marquee=document.ns_marquee.document.ns_marquee25 v! i1 L! g+ V
ns_marquee.left=marqueewidth+8
- X+ ]2 k4 B! k* q: g1 Y" rns_marquee.document.write(marqueecontent)
0 F5 y2 X" Z) B$ U$ _  D$ R2 ]ns_marquee.document.close()
8 _0 j0 d; k! M4 D. }  \4 Nactualwidth=ns_marquee.document.width
- y3 s# F6 b/ _% c: y0 b}/ @7 J  P7 J9 n* }; X$ e% S! U
lefttime=setInterval("scrollmarquee()",20): y( j, Q. }6 s5 W3 w8 A# _
}# c3 k$ ^: t$ X, E* q
window.onload=populate6 K6 P, @0 h  S0 \( H6 @6 y

. f2 S9 M0 ?4 i5 Efunction scrollmarquee(){; j5 f4 V+ o4 ~& A: P  `: B* {$ n
if (iedom){
; m+ y5 F# f: U, [( ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 x" g. z' N9 V5 W# C3 M' ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' u% G8 |; y* d8 Z' a* Y  Q/ K* K
else' v* R0 d4 h$ {8 W1 o9 g5 D
cross_marquee.style.left=marqueewidth+8
$ |7 n' A2 u6 e) j! Y
. K( n. D. R0 f0 }4 G0 l}& O9 \1 e) |) d7 p9 d7 e
else if (document.layers){+ N1 O! D) Q% \" E/ \3 s& n
if (ns_marquee.left>(actualwidth*(-1)+8))
4 I0 |6 ^  V4 Hns_marquee.left-=copyspeed
: |8 G1 m  n8 k* [  \else# X" m2 Q, M6 y4 m( T6 `
ns_marquee.left=marqueewidth+8
# L2 @  o& W8 Z; Z8 n1 d6 A+ D}8 W5 l; I! Q0 h
}
  _1 `# \& k9 ]1 a1 x1 n
( k% s; s" Y! I2 H4 C) uif (iedom||document.layers){
1 Y5 \3 G: j5 f9 s4 ~# Rwith (document){4 i; B/ W( g( r: m( V" o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( J( O( m1 Y  D# M/ C( Y1 D
if (iedom){
* m( N. w: s% `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# e2 u! n, W5 E& p% X6 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. N" \* S0 v! V, z# M$ n& bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* P7 k; e+ W5 f
write('</div>')( ^) b8 o5 u9 @
}
  [  m3 r  ?( ~0 U0 r+ j' Xelse if (document.layers){
2 G3 J- ^7 M* Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" f' f# M# H0 m! v& @( k9 ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 w2 ^# }% b/ L; |/ R9 `* o: `write('</ilayer>')8 W+ c3 F- N6 U$ ^
}
+ s) p+ O/ l6 y5 K1 Udocument.write('</td></table>')
8 L2 g7 V4 R8 ~& l}4 L$ p3 H9 F7 g; T( y" I1 y' G
}$ Q6 W  y" s* y  n
</script>

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