返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 a" O* m5 k4 |( pvar marqueewidth=300
1 v  X  U  [8 _& z% i4 N//高度
0 X5 C' e5 M8 Gvar marqueeheight=25( y6 G, r( w, N* Q0 d! f) r
//速度(1-10)
! z9 P5 q6 ]$ _# c3 U5 x' Y- Bvar marqueespeed=3
; z7 s" o3 {$ \* o! C//背景颜色  m2 ]) o% \# Y  @" y- C
var marqueebgcolor="#FFFFFF"4 D( ~7 l& T6 w1 x- W/ f' b3 |
//是否能暂停 (0=no. 1=yes)?" [/ Q6 U6 q( Y$ Z/ W1 A
var pauseit=1
' q, I  T: B" ]3 V, h6 _: f  H/ y9 u. @2 n& H# \
//修改显示内容
. k8 w) c; r! I, s( Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- H9 U- K1 v. r3 T0 M9 \
1 {* K# P9 l% b+ {  I9 `" i7 d# Q1 j$ [$ \2 n9 h# i
////下面不需改变////////////
9 n! g9 y6 E( j7 F' t2 Z) m
+ g3 Z* v3 G3 C6 k/ Avar copyspeed=marqueespeed' J0 g0 h" g! X. P$ n
var pausespeed=(pauseit==0)? copyspeed: 06 i9 ~' o% Q2 y1 U
var iedom=document.all||document.getElementById
7 Z8 m7 L0 X7 O1 ^- jif (iedom)
( d/ ~% H* Q& y; m6 cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- M% n, l. V  `" Z
var actualwidth=''0 |1 P1 x' f8 K
var cross_marquee, ns_marquee; w3 K* ^; _$ R, T. W- }

0 e. R% b) u' h( U0 ]- Ffunction populate(){
9 K2 |. y# c) x* U0 [! ]6 w5 Mif (iedom){
3 q, y% _8 `$ e. _- J9 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 Y" s; R. `. p' Mcross_marquee.style.left=marqueewidth+8# ]: F( x$ p8 p) Q, G4 U
cross_marquee.innerHTML=marqueecontent
$ h/ u( k! |  g' Y7 v/ aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 {2 B% A; K/ M4 Y7 h9 `  O0 E}0 F* Q. {' [$ ?4 o; X9 @
else if (document.layers){* Q/ ?. O! ^/ w0 a; r7 h
ns_marquee=document.ns_marquee.document.ns_marquee2; M5 N6 p! g8 h2 F4 Z- v
ns_marquee.left=marqueewidth+82 H( f& _9 x1 S. F, S4 G6 }4 X  x
ns_marquee.document.write(marqueecontent)* \& f2 D% T) O1 n, B0 E4 a
ns_marquee.document.close()
4 \1 }6 ^0 \% f2 Hactualwidth=ns_marquee.document.width3 A  f! x/ H; L- u. `
}
% _1 U. y0 m2 q2 |lefttime=setInterval("scrollmarquee()",20)
! o& s: p* x5 X4 D}* m' c" m5 K8 Y6 S8 W3 M
window.onload=populate: Q( b9 Q- {! a9 R7 s! n
" ~4 D5 g( T, t7 v
function scrollmarquee(){
! B( F  I" S! U4 D/ hif (iedom){
( ^. a0 I1 [7 I. R- P, I# Y* ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& q+ h# J% w/ k3 q2 z; X( g' U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* m) j/ \0 m# h. h) n6 N* M
else" \1 s9 I! e+ \! k
cross_marquee.style.left=marqueewidth+8
7 x2 s  O) v2 F( v! ]% A  ]. m" K$ N8 t8 y4 G" ^9 W+ G( N7 v
}$ O6 D  K% r% C+ C' e: w
else if (document.layers){
$ }9 y6 L; y! E, h( b% Mif (ns_marquee.left>(actualwidth*(-1)+8))9 u3 r6 C$ p2 M! R4 r0 y1 N
ns_marquee.left-=copyspeed
, R2 t. @6 l' P: {7 y+ w* Melse, {4 ^# G& V% @) O! j3 ^$ @, s
ns_marquee.left=marqueewidth+8
, c: }0 o* P( q/ F( v}8 ?  ?! [  P+ L% G9 \) G
}
+ Y8 o+ b+ s( n5 W( Y
# \+ O- B  N+ Z1 ~$ b9 cif (iedom||document.layers){
1 a! w* b1 ?+ Lwith (document){
5 t! p4 ?8 ~$ l. r1 s9 P0 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% t% G. e/ W0 L# ?0 K- p
if (iedom){6 O* v2 V( S1 D/ d6 ~2 M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ ]/ Y/ J: J$ n& L1 Y, X* m* ~+ gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 v# q$ k" |1 }8 m' n" P+ {$ Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ u' b. m6 L$ L( h4 L. g: \
write('</div>'). f- u  L" e8 l1 j3 p0 N* ]4 |" d% |
}
1 L" d  ~  _) K) |8 }3 b1 pelse if (document.layers){* g" f1 o) L* ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); B- u. j/ I/ i6 P3 S( Z$ y- E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 P) A4 t! h3 O: r; d  i; Twrite('</ilayer>')- A9 ]! M) l8 t* K8 Q* Y
}2 V1 j* v/ g* ^1 w+ L3 c8 E
document.write('</td></table>')
' @( y5 n  u5 s( c$ X, G}
3 G4 n; h& g1 Z  I}
2 P6 G/ g' U+ @4 B: k</script>

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