返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 ?/ _% \+ B  `0 F" S9 F3 A" s
var marqueewidth=300( `8 F4 z( }0 O" [8 o
//高度% C/ z3 V& \# ]5 F
var marqueeheight=25
0 l: n/ A5 O  a& |//速度(1-10)
" b* P  h6 l# t/ xvar marqueespeed=34 [+ X6 K$ n' X- d; W
//背景颜色
3 w& T0 y( ^- m! L1 j) j" D3 bvar marqueebgcolor="#FFFFFF": J. Z: ^: t- i6 [' Z
//是否能暂停 (0=no. 1=yes)?
6 N3 x" a% R* t) Q1 o: tvar pauseit=1/ o6 X% C$ o) `7 n8 j4 Y8 \; R; A% p
; h# L+ `& b* w" p& v6 z
//修改显示内容
5 p. k6 R2 V) L# l5 hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" M* S3 }- \; E8 X+ j) g3 w8 a: f  y& N4 m4 P& c" {6 @# k5 E
( E5 L9 d* {; z2 _" f; ^) |" |
////下面不需改变////////////
' N2 L1 n# B4 @& ^" n" Y
2 W9 {; a5 {4 _5 T& `" G2 bvar copyspeed=marqueespeed6 [$ U- N) N* a$ V& n, z
var pausespeed=(pauseit==0)? copyspeed: 0
: C$ J% Z% y+ u  vvar iedom=document.all||document.getElementById1 [$ d6 f, \$ p6 d
if (iedom)
5 r( H" u3 j+ W  c, I! qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- d4 o  C$ s2 I" [: G* o) s
var actualwidth=''
( o7 M* ^) ?! l0 fvar cross_marquee, ns_marquee7 B: m) U; E( _( I1 q

' e  Y% _8 q; H' W. V$ F4 kfunction populate(){# X2 I  e+ C+ G# V/ |4 }3 s' k% k
if (iedom){( ~- F4 q  h8 }! ~3 D( i  [6 L# Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. }* w. m; m/ A1 Z0 i1 \& R
cross_marquee.style.left=marqueewidth+82 y8 e7 T* ?3 V, q3 X0 b
cross_marquee.innerHTML=marqueecontent
# ~* {+ U8 ^& ?' M% S! u- Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& C5 |1 G" Q6 g8 _}. {- S+ U# _5 A/ h) m7 r
else if (document.layers){1 e% g! C3 S# ^, f) _
ns_marquee=document.ns_marquee.document.ns_marquee2. Q, s$ o+ f" \' p4 ?' \
ns_marquee.left=marqueewidth+8# r9 n! N. j7 L2 ~
ns_marquee.document.write(marqueecontent)
& Q5 g) {' o8 |2 R1 Wns_marquee.document.close()
7 I! c4 p9 x( i0 [# p( Ractualwidth=ns_marquee.document.width
2 R4 J, U" V& U0 ^}# h9 N$ `0 e8 U9 Z/ d% r/ S
lefttime=setInterval("scrollmarquee()",20)( n! h( X$ ^' Y( k: @
}* Y, W( [( G  ^& |' T* p6 S
window.onload=populate
9 k0 p5 S5 Y" B/ ?- N. A& C. \8 Y) G( j/ W) J2 ?3 S
function scrollmarquee(){
: x4 j$ K1 r2 E( }, V: Rif (iedom){
% D( T. c" }0 h7 c8 Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 F4 |9 C( W5 V$ z% G" |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 y! f" i- F5 g6 b
else) e' y! N7 t8 O" ]5 D: d
cross_marquee.style.left=marqueewidth+8% \4 s) t/ u7 ~
' Z4 I6 q, x/ `0 V* A1 H" m
}2 `" I3 C) Z" N, V
else if (document.layers){7 n4 g+ L! B6 h" u# t
if (ns_marquee.left>(actualwidth*(-1)+8))3 c! {+ m" F* m9 T7 |
ns_marquee.left-=copyspeed
. {. M+ W& ?8 |6 }else
6 @9 a6 b$ S. ?/ i. l* kns_marquee.left=marqueewidth+8" L( |8 q. [4 Q
}' r: D+ S5 _! M9 f8 i
}
+ {$ x/ c/ J3 U/ Q& e+ G5 u; Y9 B2 x
1 v1 t- ^7 M; I" V$ vif (iedom||document.layers){  H, H1 d( U7 K6 @; a0 Q
with (document){
6 N' {9 ~/ J) y9 h/ g: W. Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 f, b8 b! \' b* u7 t
if (iedom){
0 {7 m/ g  A5 qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& K1 }/ r& O" x; r$ Z) \( {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& u1 U( b0 u8 b! C8 E% Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 M4 M- x/ D2 hwrite('</div>')( y. S: ^: M7 S* G# p
}
, f* A$ I# v; F4 Telse if (document.layers){
( M0 J7 S# R- ^% n( a  Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& y( L* B8 p1 E- M/ w" R3 u) I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 M; g  v3 e' n9 p6 L( lwrite('</ilayer>')
2 G* _! O, z8 R7 ~  q7 v& h* i9 n$ a}
) D( X' F. E! `+ G5 ^document.write('</td></table>')
( b8 I! c1 o# R}8 f! A8 H$ l0 W! ]0 M
}
( y4 H4 @6 U* p* m</script>

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