返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 [- N0 n! p- X& M) q: H+ z  f+ Wvar marqueewidth=3006 G" ~: ]8 b# V6 y- r' a
//高度
; G# k& |$ U4 F" s0 n+ @% Nvar marqueeheight=25) v+ w9 `; F. u) B
//速度(1-10)
# Z0 y/ u3 H7 L0 T8 u9 a" m$ f# L9 svar marqueespeed=3. ?. j" z4 k4 r7 q* ~- d; L1 }
//背景颜色
, C9 U$ F* M4 ^9 s8 e+ tvar marqueebgcolor="#FFFFFF"5 A7 S7 ]' D: r$ F  b& W
//是否能暂停 (0=no. 1=yes)?
9 M9 z; h5 t$ d5 u/ ?, V0 [var pauseit=1
! V! O6 x4 o! j3 L. i7 f, t' n: i0 H8 R7 B% u: o
//修改显示内容. b; ?/ H5 W+ m  C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 O1 p/ B, V; \2 J7 U: N2 d

; g/ T7 o& o$ v) C+ J- ?
' r0 X4 ]9 b1 v0 G# ~////下面不需改变////////////
2 A1 u# Q/ i( x6 C& ^9 X9 Y0 s! p2 k2 x2 n+ p% x- f0 i: d
var copyspeed=marqueespeed; [, [% G3 V8 O; Z( `% H9 H
var pausespeed=(pauseit==0)? copyspeed: 0. L! w4 w. n+ y
var iedom=document.all||document.getElementById- e. |6 ]( Y8 Y7 q; r
if (iedom)
) Z; ?) V* V. f1 P7 u5 B! V) Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 u& g+ w- }6 f. Z" g) J+ Ovar actualwidth=''" O5 {  J( \/ B- Z
var cross_marquee, ns_marquee4 c+ l% `" V, Q

; D2 T. `( ]' M& z" Cfunction populate(){* L7 f# P7 y0 `+ J" F/ s
if (iedom){
: P4 g3 c+ P6 D. y6 p: S. F* D0 l3 [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* E% |& `8 ^8 y' C& k
cross_marquee.style.left=marqueewidth+8
6 @5 x, ?7 U$ }7 ~2 n5 ]- lcross_marquee.innerHTML=marqueecontent! C: N& g+ w) I$ s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 _: T, k3 E+ j. ]/ d" p' k
}
/ }  D* L/ n% r9 M$ Telse if (document.layers){( X& l; ]+ S( r$ H8 E" a
ns_marquee=document.ns_marquee.document.ns_marquee2
9 w8 O" M3 D1 A& k# [. t1 Yns_marquee.left=marqueewidth+8  Y# d$ v( F" f8 t! ~
ns_marquee.document.write(marqueecontent)1 Q: n# J6 r, s1 V7 _8 s" j
ns_marquee.document.close()
2 h5 h+ {: |# `! ?, j/ p$ r- Y% Factualwidth=ns_marquee.document.width
6 x( C3 d) A, p: i3 r1 C}
" J$ X$ P! m8 k# ]lefttime=setInterval("scrollmarquee()",20)) l* N! h' O1 _8 [
}& c4 ^; d+ n* p' S2 S
window.onload=populate
$ B. U* F! T3 |1 a( t6 d6 F
5 G# ^: s" j; Y, i; L: {4 gfunction scrollmarquee(){
8 b$ P, c: {% s% K1 A' w7 S& M5 Jif (iedom){
) m2 I# b  T0 N' v" q- \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 j0 m1 a# E) w: c7 jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, \/ E  k* w: X, Y& N3 pelse
6 i, ^- h5 @  f* G- I$ F$ `cross_marquee.style.left=marqueewidth+8
/ Y4 D# V3 W! I9 F: J0 p4 F6 [6 v8 w/ d. `2 J( {0 F
}
2 _) A) C3 l5 v7 g! ?4 f. M+ [else if (document.layers){
& q. X# J7 P+ i( dif (ns_marquee.left>(actualwidth*(-1)+8))/ a$ c2 ~: f- F8 x, H6 a7 Y
ns_marquee.left-=copyspeed
" \- Z0 g0 n+ f4 x6 Delse
$ V( }9 w- r) @. D1 @ns_marquee.left=marqueewidth+8
' _7 u5 t2 u1 L}, g9 y8 F3 p. J: _' l& W* `% q
}8 {( \& }9 ~4 t

6 R9 r# N/ ]" d1 B/ eif (iedom||document.layers){8 f" N% {  U& n$ u+ _: c/ N
with (document){
" g, `! V8 o7 vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( u1 x: w5 V2 A7 c$ p3 Y$ F6 \. Mif (iedom){+ r9 x) t' x  n6 u/ y- P4 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! g- K+ k1 {6 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" P! q- e; v  b+ j: f2 F  L: ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ d9 t; [. K6 a! c
write('</div>')
2 E- t* Q, L+ Z5 s# M}! x9 g/ G# E% @: K' _8 _0 \" d
else if (document.layers){" ~( c2 I  z3 @! M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: o3 _# g) V9 E$ \2 N1 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; n$ P# t, }# h" t. t$ nwrite('</ilayer>')7 o* [! ?- N; ~: Q5 r4 Z% [7 R
}
3 N# {# Y/ [+ e2 [3 s9 |2 sdocument.write('</td></table>')' A6 f8 r7 Q5 m5 @& s
}. [0 m' B+ O( c. g& g; T3 t  s
}* f- w$ m% D" Z- ?% k9 p1 o
</script>

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