返回列表 发帖

网页之跑马灯文字特效

//修改宽度, [' t" o. O- `0 c: C6 Y6 q
var marqueewidth=3009 J- L/ Z8 f& Y* O
//高度; T, P. m+ V, D# A/ X
var marqueeheight=259 I+ B. V- v' D& |0 m4 A
//速度(1-10)& g, m$ A" \8 Y2 e
var marqueespeed=3
. I; o' q  U. G7 M- p' i* j//背景颜色1 [# _+ g- `! U$ Y- ]
var marqueebgcolor="#FFFFFF"' Q9 V/ e, ~9 `, Z! i
//是否能暂停 (0=no. 1=yes)?) c6 z& q# b( w+ N4 ~
var pauseit=1
- b) r4 V5 F' _
. y( ?0 s/ [3 w% ^9 U+ t2 X//修改显示内容1 Y( A" V6 C' \0 T1 O& ~. J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) x2 l5 R" v; C- F4 U: C: g5 C
5 X+ c" u1 x; ?8 s; q' f8 L) i! C7 u; U; a
////下面不需改变////////////
8 b; v6 o* B! s- F; s6 ^# k' B* J) ^
var copyspeed=marqueespeed
, E7 |9 M! H$ W. K" Nvar pausespeed=(pauseit==0)? copyspeed: 06 P. a# ~1 I5 m
var iedom=document.all||document.getElementById
$ f' t! d& G' v9 x1 Qif (iedom)' r" M6 [/ D, D- ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. Z+ x3 \) C) }" ?4 qvar actualwidth=''
. N. Z7 H" A* _) i& ^  Y; ^4 uvar cross_marquee, ns_marquee  f( a0 i& B$ P
! W$ P+ R9 M& Y' C, u) s1 |
function populate(){
$ ~$ C( h! u# j6 p; M0 V8 Gif (iedom){2 e: F1 |" C7 a) m# `2 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( X% [1 b2 C$ f+ D9 T
cross_marquee.style.left=marqueewidth+8# W  S: T$ Y% `/ R9 G) X# v3 N
cross_marquee.innerHTML=marqueecontent
0 L+ h" X5 {& }& V# `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 z! U! S: L6 `6 F; O; A, Q" J  N
}7 \( w4 V2 \7 n0 `8 f# L& h' j; `
else if (document.layers){2 M9 l7 g  q* t% Z) L9 M
ns_marquee=document.ns_marquee.document.ns_marquee2
5 q5 Q: H0 u  |$ pns_marquee.left=marqueewidth+8
& b. ]$ |  Z3 W0 k9 Q; p6 E% X  ans_marquee.document.write(marqueecontent)$ |4 ]% f# I2 y' l- Y
ns_marquee.document.close()" Q& L' E' v2 W* T; L
actualwidth=ns_marquee.document.width+ j' ?' O% G8 d2 v9 t
}4 ~$ r) G  B; ^! K
lefttime=setInterval("scrollmarquee()",20)$ n  N( x( y; W3 y- V
}
  h7 I& b8 J  T9 E" l/ Zwindow.onload=populate
. a: f3 n# F7 D+ e3 [- x% A: [3 I' Q$ q  U3 L
function scrollmarquee(){, c$ ?3 v6 q4 l! s8 Z4 ]
if (iedom){
6 e- Y' ], [6 L% N5 D& Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 c% I3 y# r/ H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: s' e% D% q7 K5 F- \else
. Y! g' L9 F+ v: E$ ncross_marquee.style.left=marqueewidth+8
, [  B9 M. d8 ^# l* l' X7 _5 g4 k0 H* I; @/ D- P1 p
}
; j: w: P" X( ?% ]* p7 Belse if (document.layers){" u/ B0 J1 ]  F
if (ns_marquee.left>(actualwidth*(-1)+8))
, j. a/ w6 D6 t& X! h% \+ ons_marquee.left-=copyspeed
; @8 V5 Z( B) T7 Q; E; d5 M- Welse
9 {: l9 i% T2 x- r/ a% p" [ns_marquee.left=marqueewidth+8  Z) c. ~; O1 q- [; k
}
: Q/ n9 T0 X% Y7 n; f}* c; i! y/ n  Y1 }# X) \0 d
3 \) [3 M' m5 L2 G
if (iedom||document.layers){
8 K& T# J3 R" e* x$ Z$ R/ mwith (document){
! x+ ?9 e7 `5 F$ X3 D0 M4 Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 `/ D* `# ^4 x! f# I( k; v" I
if (iedom){- U6 j4 j2 X* ]. E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 j! ^( _, ~# d% k1 s* U4 {2 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% \9 N3 [0 O1 l; @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, M% p+ p- Q1 wwrite('</div>')  |! ~9 D' m! k  `. G5 ?4 w
}2 r1 m& B$ j6 \+ r7 C  `# D$ \# @# e! Y
else if (document.layers){
' M0 ?" f9 q  Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 h, n8 z: _; L1 Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 H3 A+ {8 w0 R; G4 j1 }" Uwrite('</ilayer>')2 w' q7 B5 Y$ y) S+ N7 \6 q
}
- F) n: i/ G! G/ J) x; Kdocument.write('</td></table>')
6 S+ @6 g( F) O( f9 D}
) e& c6 P" @: _  W  I$ k2 [; \}: o+ q/ h/ O* J
</script>

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