返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 y: T/ a3 f1 D& S- ^
var marqueewidth=3001 K3 @; o4 R/ P" A2 p* a
//高度, e0 ]5 j1 P5 c
var marqueeheight=25$ L% S1 e! G& A+ U' [
//速度(1-10)# a3 a+ T1 x7 f4 [8 b' m( Q
var marqueespeed=3
0 v* B6 L. |* \+ E9 C* I( X//背景颜色1 ?$ h2 x$ V' p/ l
var marqueebgcolor="#FFFFFF"
3 ^; d( Y  U: ?# X//是否能暂停 (0=no. 1=yes)?
2 X& Z7 O& d. V" Mvar pauseit=1
; m5 x# q' j. o- ]1 ^# y) d' ~; C: T+ S* z( N  t* Z' u( ?4 d
//修改显示内容
0 Y1 g, M/ j8 L+ ]4 ?' yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. {9 d; @/ t# s/ u; i

1 h2 z8 U9 S3 @7 i  ~, {# E+ G0 U, b$ H8 L5 {
////下面不需改变////////////
4 _  F0 [$ K0 o# _# r
" ^0 {. n& \& V% E6 Xvar copyspeed=marqueespeed1 b7 ^; t0 L" Q8 t
var pausespeed=(pauseit==0)? copyspeed: 0
! O( }. P8 t/ U, R% B9 o  Rvar iedom=document.all||document.getElementById
% X8 ?. R. @# {+ P3 cif (iedom)  w+ S* f& y1 X6 ^* E* q. n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" o' i1 D' d3 A& O' P( U# N7 J& I
var actualwidth=''
6 w& }/ [4 D/ O# e# t( ?$ `6 m7 zvar cross_marquee, ns_marquee
8 x, Y0 r1 b3 Z3 H. L- t9 i! i1 @- h$ l% D  r
function populate(){" r0 b1 o+ u% z: Q$ }$ W" v3 `
if (iedom){& ]- a& n1 k! Z4 ~" E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, N) C$ h% A  w  v6 U) dcross_marquee.style.left=marqueewidth+8  W/ a. e/ I1 u1 c
cross_marquee.innerHTML=marqueecontent: J( B- w( t, @. U5 N, t7 y- b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, t$ b% v' Z: {0 `4 s; E: ^
}7 P9 O2 _7 G* _" L5 H
else if (document.layers){
2 h0 i8 a2 g' U# e  hns_marquee=document.ns_marquee.document.ns_marquee22 Z0 a8 r, r$ [! E/ k9 n
ns_marquee.left=marqueewidth+8) |: O8 L% d$ v* k- ]4 m- j6 ]- Z
ns_marquee.document.write(marqueecontent)+ g# |1 K# p7 R* [6 ~, B+ a
ns_marquee.document.close()
$ Z/ k% e, E6 L- ]2 t- S; _3 j2 uactualwidth=ns_marquee.document.width4 C- g5 }3 s8 c" H( T
}& V" S' A2 B3 K( t0 _1 }0 H4 M! }2 ~
lefttime=setInterval("scrollmarquee()",20)
8 t. d. ?; j) A6 z+ p; U1 I  u* c}2 b% k' t9 `; d7 [
window.onload=populate$ p' G5 `5 x9 o+ v# t$ i9 f. F
, }1 g* s4 ?- P6 t* X8 r5 [! R
function scrollmarquee(){
& g0 o0 N7 ~: i" _  {: a  M9 g0 \if (iedom){$ J7 ~0 I! D) N. O# H7 I! E% q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 g& M- w# e: tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 D9 a1 l# e6 C6 [2 V: p: Kelse
/ {( S7 l9 G* \cross_marquee.style.left=marqueewidth+8
) `7 ~1 o9 p1 @8 y
# F9 ]3 a$ b* y& I7 x/ m6 b}
6 D' U$ z; Q2 u0 F3 M  jelse if (document.layers){/ g% {) G- ?# S) S
if (ns_marquee.left>(actualwidth*(-1)+8))0 u& {+ Z" R8 m9 G4 c5 |
ns_marquee.left-=copyspeed
8 L* l7 \. c& E" melse2 j0 m" F9 F0 C1 @# ^. U
ns_marquee.left=marqueewidth+8& K  s$ O( Y( z  a
}2 p& I; Z; ]; Q
}7 a. \" d+ e5 A2 v/ E
% Q& X# Y$ J/ d
if (iedom||document.layers){
8 e4 B( C1 s; }: Zwith (document){
# y* L* b6 F" S% _! V- q  qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ l; U7 g+ e, x" M: r
if (iedom){; ]$ e# \5 e" z7 X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! ~7 q; n" k% }- i  U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 `/ X- r' q3 _1 l$ Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' P& r% Z  Z( U' H/ O, r4 vwrite('</div>')0 p6 j7 z) T) ~8 W  ]( m
}! `! }: w, w& i" r3 b
else if (document.layers){# D! r2 C- h+ A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& K9 e* X6 u$ a" N& _( L7 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 J# ~+ J0 Y% e. T+ h1 v5 A
write('</ilayer>')) M* ^" \1 c( P# a3 V. [
}, Y) ~) h  y4 Q% G  m
document.write('</td></table>')0 U$ ?' x6 ^2 r
}8 w, Z2 s3 {, n4 l
}, e9 K- x) d4 z4 ^& v
</script>

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