返回列表 发帖

网页之跑马灯文字特效

//修改宽度* F, q1 q# S3 \
var marqueewidth=300
+ Q! ]2 ~" n( [3 K* u//高度, }) |; C. \6 x  q! M/ G6 o  j8 E
var marqueeheight=25" k* Q: O! J) S' o
//速度(1-10)) u( e' i9 I; U; }3 ]$ G
var marqueespeed=3" e( x: k8 L7 m& W( G/ }/ H, K; K
//背景颜色) u9 ?8 |3 s. l1 C5 S
var marqueebgcolor="#FFFFFF"
- y: M2 d0 Y. k' @$ F4 x: Z//是否能暂停 (0=no. 1=yes)?
( C9 X% ^0 T  Rvar pauseit=15 Q0 [5 [0 B8 K1 u

& k7 {  N( ?( B//修改显示内容+ t: [3 E# ]# [0 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- L1 Y( o9 M$ [( D( b

. }8 {% r. o4 l7 }
9 E' U3 y0 W/ V, ^% m////下面不需改变////////////8 D3 ~% e- L* {' T

& y; @6 k9 G3 V% Hvar copyspeed=marqueespeed
  X9 N: z; P) z- k+ Z0 @var pausespeed=(pauseit==0)? copyspeed: 0
/ b: E+ G9 d7 q# evar iedom=document.all||document.getElementById0 E. Q8 u$ x1 w. M6 u
if (iedom)9 b4 K  x" j9 K$ _! {, ^0 s( c' @0 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' S2 _8 H& L" J2 H' @# vvar actualwidth=''
6 [3 x) h5 Y$ J9 a! u9 ]var cross_marquee, ns_marquee
% y0 C: h, ~% e  n0 u
/ F. ]* c9 H- ffunction populate(){( `' \& @; [9 h& Q) u2 l/ b# C9 Z
if (iedom){
1 O) j, p- @9 @& T+ x* ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( S4 Z* b0 s) J5 t- Bcross_marquee.style.left=marqueewidth+82 k! O5 N4 E- g* l" ~5 N
cross_marquee.innerHTML=marqueecontent4 I) V# T6 |+ m+ e. k+ t  \9 L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* R9 g9 @9 q/ {, X7 k9 J* I) M+ {
}
+ T9 m" m/ @  L$ v9 G/ j+ Zelse if (document.layers){
# n$ C: J* u* w0 w+ K) h* sns_marquee=document.ns_marquee.document.ns_marquee2
1 ^! ^, J) L% O/ q0 k* jns_marquee.left=marqueewidth+8( K9 O7 ~$ H/ u) [, M5 n
ns_marquee.document.write(marqueecontent)8 I' h% M6 z7 J  Z" T/ |
ns_marquee.document.close()
; _1 A* r6 O: q5 R9 vactualwidth=ns_marquee.document.width
; P: Z  O7 a, B}
6 p3 {4 p3 x- @0 N% Y2 Blefttime=setInterval("scrollmarquee()",20)& d: N6 @( U7 }; `
}
" b% K& `' y0 ?window.onload=populate
( S3 E( [9 H5 Q% t+ r2 i' x6 D& I
5 x# B0 @% ]% O8 A0 J) A0 ffunction scrollmarquee(){
9 Y. \; V) l7 F- dif (iedom){1 e" M: w1 J/ G, e- ^* f, Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# }8 b& ?+ l( V; Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ d) c) Q3 |* O" |2 k8 I7 a( ?
else- q0 K; i% S6 |6 Q, F
cross_marquee.style.left=marqueewidth+8* W$ z1 [+ H: x$ Q3 N
1 k' T: q! K! s% b) d  m. {
}
2 X- }  D4 [: S! Telse if (document.layers){' {% u6 F: W' `* [1 M
if (ns_marquee.left>(actualwidth*(-1)+8))1 b. c8 x2 v3 A; C. C
ns_marquee.left-=copyspeed& s0 D. `: Y& J4 L; x  g2 M# Z
else4 U- `% {1 R8 P2 D0 W0 Y" o3 R0 w
ns_marquee.left=marqueewidth+8( P3 a( r$ s; M1 E/ l
}
( @6 G* Z# [+ F/ C}
! [9 f' e4 {$ x) x4 i3 M' `0 t9 y; ^
if (iedom||document.layers){
; J: \* B3 J2 \$ X6 Y1 t" s7 h$ gwith (document){
8 b8 Q' ]0 k( T! c) |! H+ ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 e5 B) b, O- X* b2 N4 uif (iedom){
! P5 ~1 _2 i2 s# ?7 L" J3 F0 k  Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* N  i8 h0 N, i# R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ g, x3 K) w" o$ s% g  @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! [, z: ~) Y! X* R& X; M; ^  ^write('</div>')8 D9 }& {& K8 D
}( y, P/ _" |5 Q5 R8 Q2 M/ }
else if (document.layers){- q. F9 Y1 q; f$ t+ Y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( t1 s! T# t1 T. t3 T8 y" p+ Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% _9 [  w, P, C2 d' ?write('</ilayer>')! S- }6 Q/ Q+ m7 \0 T
}
' C% j$ m5 C4 w+ _4 o, ddocument.write('</td></table>')
! a, _6 b: T3 R/ Q7 E}
1 Y8 e$ z, V2 i  d$ u}9 s' X% q$ r% P
</script>

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