返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" d+ v* n0 _) t3 x8 K: X5 p% j2 Fvar marqueewidth=300
1 g! ]& P% J0 B* ^7 n5 Z& a6 I//高度
3 x' G7 I( D) t, xvar marqueeheight=25
( d+ ^' G" K: R: k7 g4 r//速度(1-10)  m: {* P: ?. \) u) q0 N4 S! U. P2 y
var marqueespeed=3+ ]! l% |5 ]: x9 J  {
//背景颜色
, M+ W8 J4 }* O8 Tvar marqueebgcolor="#FFFFFF"
  C: r. o2 g; Z: H3 n& V9 i8 y, c//是否能暂停 (0=no. 1=yes)?" G9 A+ |7 z7 d" f$ [9 z
var pauseit=19 [) w& h% q( q

2 B" q; @& ~( @; ^) F2 I//修改显示内容
9 n4 w# T& _. M# F4 l$ _$ o# o- P6 Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& s$ w: n& }! J$ p* s- B1 B
" H' `$ w* N* _' c- M: S. d; d; A7 `; e* v7 c' \
////下面不需改变////////////
" h* J5 k: d7 q5 k
: I$ s; b6 R8 n$ H9 Uvar copyspeed=marqueespeed. W8 L( e$ m/ H, Z
var pausespeed=(pauseit==0)? copyspeed: 0/ Q# A" {' Y) {0 S# P0 }$ F
var iedom=document.all||document.getElementById
' G0 t/ |' V7 ?if (iedom), u" Z6 R% g" C% s8 t8 m; q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' [" y' w0 C  f& Vvar actualwidth=''  {; `. V& v& u$ P, _& u
var cross_marquee, ns_marquee9 m3 U0 e3 C6 b

5 K9 c1 v( o% m; ]/ v4 y( v/ k9 C$ gfunction populate(){8 U& c- }. t1 y' V+ U: o! u& A( j
if (iedom){
& _4 i9 Q# ~. p' T3 [% c/ O/ Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 k- p( _: [  Kcross_marquee.style.left=marqueewidth+8! D* M! N- S1 s5 C
cross_marquee.innerHTML=marqueecontent
" w  g3 R6 M7 i; @0 @3 g6 Y2 j3 C0 ?5 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 L% k5 j) w* \4 L2 C4 i$ A
}* |; z& s. C& S9 q. F5 s) J8 D7 v
else if (document.layers){7 g/ s$ w3 u; C( w6 _; H
ns_marquee=document.ns_marquee.document.ns_marquee2' N: Q8 h+ e) [0 X5 S- y/ ~
ns_marquee.left=marqueewidth+85 K7 b/ i4 [1 W
ns_marquee.document.write(marqueecontent)
0 j+ |1 f) k# S# D8 {+ k' ons_marquee.document.close()
6 T9 G6 V# c4 Y2 d& y5 \actualwidth=ns_marquee.document.width; I( H$ F5 U/ i+ r4 R4 V, R, W
}
) T4 p' u2 r! S1 U! u. n* Dlefttime=setInterval("scrollmarquee()",20)
% T- q9 ?6 N, ~/ X2 f5 }& C}, |/ ]! _8 j4 I4 H6 ?. V) {% l
window.onload=populate# m3 W: a# Y9 X4 e3 Q- ~) h  V

; O7 X% r- m6 T/ n( N4 E, T5 Z+ T2 ]. Xfunction scrollmarquee(){$ w- z' U8 d; d7 T5 W
if (iedom){3 l1 [9 v5 V* f" b7 x  U/ [0 E+ k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. R5 J9 N1 X* ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* Y( j+ N5 z6 x3 Relse# B1 c' g; j; _4 B* [2 n
cross_marquee.style.left=marqueewidth+8+ t8 r9 X. t7 x( |4 h8 U# M- T

6 V7 ~% U* i5 S/ e}
/ B- w, m% c6 w( V5 ^; uelse if (document.layers){1 |( B  x/ J( h) Q
if (ns_marquee.left>(actualwidth*(-1)+8))
  V0 A9 A2 S# n* W% T# dns_marquee.left-=copyspeed
: f& r( O$ O9 v4 ^else
8 h; q/ G2 \: wns_marquee.left=marqueewidth+8
; Y  i: E* Q) u8 G}
. i: K7 \, g6 S7 v6 M- W7 }}9 l* R( I. f! z" V# o* X

3 T3 h  N. l& d* A1 `if (iedom||document.layers){
/ |, k. f  H6 l! Y2 K9 c; @with (document){$ c) K7 ~9 f4 z, O" r2 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 H# j5 t. D2 W- }& D! C* i8 Sif (iedom){+ t$ l! A  a" v9 y. }" B8 V0 t' g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 q3 M$ D4 d& |3 V3 _& \" X4 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ V) f* x  J: s, `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' F8 ~% r! V+ ?9 @  O  R7 ywrite('</div>')
  j% e$ k7 j+ S( P6 n" n6 Y9 |}0 G$ t9 G( i% B) U9 R. Q
else if (document.layers){
& q) S1 y$ X+ d! ~& i7 ~6 \6 ?" P( Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- F2 j- ]7 ]" b  e5 q( Q% V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 C& I! F2 q( Q, s2 F$ swrite('</ilayer>')
( G1 |" h: B# L7 r1 i  p6 g}& I- w+ z- u1 [" [! V$ ^0 \! D
document.write('</td></table>')
: {0 O( W5 h! b+ ^/ a; R0 G}0 `  D- C( v: e! I
}5 {& K) f4 k. b' \7 {$ A
</script>

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