返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ t( A: `; B3 L- s4 C
var marqueewidth=300
) T# W& ~6 w& Y: o7 Q  i; O$ x//高度
7 Y* \, v* K( N. v/ W# V- Y4 I; L& Zvar marqueeheight=25  o( Z1 b. N  r2 W9 `- b$ M, s
//速度(1-10)
* v% G6 {# J+ N0 x) W9 yvar marqueespeed=33 z# e0 ?) c2 \) n
//背景颜色" q3 t. k- u( q, b- R
var marqueebgcolor="#FFFFFF"- i  D2 [# V5 u: D9 ~$ J  K9 {
//是否能暂停 (0=no. 1=yes)?
& _' d2 p& A1 V7 B  c0 F+ Mvar pauseit=1
8 i: i/ ^. F% {! l# K& O" Z4 G
//修改显示内容
& m6 r; K/ q, _# F) f9 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- V$ Y/ h6 s: \: _) \
: r, C4 B4 X' G' `2 h* m( x) e  [( N; q. R, w
////下面不需改变////////////
4 j2 s7 B3 {2 G8 [: w
/ i5 k4 R4 O4 W. b& Qvar copyspeed=marqueespeed
0 h  q- h* |; Qvar pausespeed=(pauseit==0)? copyspeed: 0
* `: D0 M$ L0 A( V5 ~var iedom=document.all||document.getElementById0 Z# @- o( h  |4 U0 f
if (iedom)
$ G* Q3 m* F; c0 v3 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ y1 D" ]$ s/ s3 ~' e& Gvar actualwidth=''8 R, V' l$ Q- L, ?% _- y" ]5 }0 }
var cross_marquee, ns_marquee4 ~% k1 U( b5 l5 L
' v8 k. O" e; J$ _: Y" \  r
function populate(){
+ @2 L: k* M% r6 O" i6 oif (iedom){
9 z# i5 }' t4 C3 j1 ^% o6 a3 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 I& A8 f( q, S" Gcross_marquee.style.left=marqueewidth+8
' G: z& E" e  L: P. Mcross_marquee.innerHTML=marqueecontent0 {' s) r  g9 D5 |+ u, U3 S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 _5 V" I: Z) F6 F3 o# Y! ?3 l}
- _9 `  L" Q4 k% ~5 c% ~else if (document.layers){: |2 Q7 _5 W5 q8 \5 D
ns_marquee=document.ns_marquee.document.ns_marquee28 S9 D1 v6 q6 l0 j( X. \- _2 ^! B
ns_marquee.left=marqueewidth+88 E6 B1 S5 @* e: M# N
ns_marquee.document.write(marqueecontent)" [$ J5 J6 A) x2 H
ns_marquee.document.close()
# r: Z- g: X& cactualwidth=ns_marquee.document.width0 l+ j! k) ?8 K3 q1 L; J
}
# {- L5 x7 h8 y5 Glefttime=setInterval("scrollmarquee()",20)
2 r2 D; q$ f' y% G4 T}( d; E$ T4 t$ w$ `* e
window.onload=populate$ a+ o; V! p# Z" \9 W' |( f

$ y1 C2 T& s8 y  M, p4 zfunction scrollmarquee(){) d! b. z: ]* l9 r( w. |) [0 g
if (iedom){
1 P, ~% ]2 R5 p2 n" T0 yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 }( t( _& X/ j2 I% ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" Y- ^8 I# N$ f" l+ Felse3 W) w5 f+ W' v. Y* L- ~
cross_marquee.style.left=marqueewidth+8! M. P. D4 W2 k) n! a. n
$ L+ Y5 u9 h6 Q
}
, n/ P, \) z  N# z  aelse if (document.layers){
! I& }/ @: ?, W. y! K* Tif (ns_marquee.left>(actualwidth*(-1)+8))
4 `0 V+ M! h; gns_marquee.left-=copyspeed5 g3 X6 K) V3 w8 d% y  u
else
9 G  B. T% i. r1 Uns_marquee.left=marqueewidth+8
8 l1 ^  R% M/ ]1 M4 A+ {8 w) O( j2 G2 L}' u: ]* _% E2 y
}! E6 X9 k% n  ]4 y" k- S$ o
5 O2 o& j1 W* o1 B
if (iedom||document.layers){
' c- g: b: M2 u9 ^with (document){, L- l( l& U; p" B- g% F; p* f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 K3 u% P( i$ h; {8 y$ Bif (iedom){" }' C) F1 ]& Y% H3 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' m; L7 u& u- Z; f; v  Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 ~4 q0 P# p  e" `& u% }; \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 E( ?8 P2 p3 ~) X5 Vwrite('</div>')# A# c  D8 `4 s6 j! c* I
}& G: G7 y5 R) F& g
else if (document.layers){1 a2 B5 t* n* j: f7 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, R3 y1 w* z' C' g) D3 q+ s% dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" h4 L1 L1 J2 `5 C% g+ h& }: twrite('</ilayer>')
! q) x; `# A1 b9 R/ d}! s( i7 |# `% Q5 p/ p4 O, D6 z
document.write('</td></table>')
$ a6 _: z0 [3 \& y$ O! X0 Q}: t6 ?* C. t; `. L
}/ F. ?* |& W8 E& q% K( U
</script>

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