返回列表 发帖

网页之跑马灯文字特效

//修改宽度  g* i2 l/ N8 l5 ~. E: e
var marqueewidth=300
& B: @) t& Y9 \, ~) u7 i//高度, u& @" V* c6 d) R* l
var marqueeheight=25( h& N3 ?% [9 a. a
//速度(1-10)
/ V$ j8 R8 {' s3 ~var marqueespeed=3; I! B5 V) s4 h* e$ S/ n3 m5 v
//背景颜色
9 s, h! N9 B( e0 t: y' i) z/ w8 ?$ r3 Lvar marqueebgcolor="#FFFFFF"
* Z8 C  {' [# e3 @1 I; S; E//是否能暂停 (0=no. 1=yes)?
! X9 Y( ?4 S' zvar pauseit=1
% Z- c+ x& |0 \0 C  V( i1 n8 `, e
1 ~) c4 S+ C# D: [' c, v* ]1 P: {//修改显示内容
; z: c" S1 \0 F: Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 S( C* n# w; P; G9 Z$ i0 K8 l
3 Q6 c& O; L0 ?$ r% U# c

/ o9 b7 A* Q9 r& m2 l8 b. I  _////下面不需改变////////////
/ p& Y8 ?6 `! B! ]  e; g
5 L" p* U- m4 h5 yvar copyspeed=marqueespeed2 P6 p2 W3 A# ?
var pausespeed=(pauseit==0)? copyspeed: 0$ j- T1 [/ ^3 @- `5 s% b
var iedom=document.all||document.getElementById' o; k; u9 t3 \$ K- T
if (iedom)
' ?$ }+ p4 n7 Z) l5 Z; [* l" ]document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 v, n. k9 R8 mvar actualwidth=''
! e! D7 D9 q) j" ~% `' ~var cross_marquee, ns_marquee4 F7 _8 q2 |. `6 G: i* k" X: H% d; y

, s9 |9 L, f, v) ~' ?function populate(){
! u" ]& D( m# M7 J( hif (iedom){' T5 K9 C: s& H! @1 `1 s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" I! T' W/ D  k) O
cross_marquee.style.left=marqueewidth+89 [4 u. e% G  [  a. ]8 o, w
cross_marquee.innerHTML=marqueecontent9 ^' l8 _/ U* L$ y* V3 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ v# p8 O1 z* h3 A& z
}
$ I8 M% t& [- t, Velse if (document.layers){9 r6 Z' v( p5 X6 i( [. }
ns_marquee=document.ns_marquee.document.ns_marquee2
9 ^& q' W6 a  Y7 v& xns_marquee.left=marqueewidth+8
. g& ^% i4 I; J* H' s* H4 dns_marquee.document.write(marqueecontent)
. i" n, Y4 s8 _& Dns_marquee.document.close()) K- `6 [& H- Y! n/ A5 `  |
actualwidth=ns_marquee.document.width+ X8 m6 D0 j! [8 ~9 j3 \: {$ W
}9 u, O3 r+ c8 ]
lefttime=setInterval("scrollmarquee()",20)8 c) I' E, o: `/ A0 `8 n
}: X5 y# p9 p: [8 e" U" ]' Z1 h3 e
window.onload=populate% K8 w% x. G7 p7 N2 K" @) c2 ]1 p
. R  i7 q8 `9 H. s' H
function scrollmarquee(){
( f8 s1 }2 m1 w. ~8 j  ?if (iedom){
$ e1 |0 a, y; \$ Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 A8 L1 q3 @" q! ^- q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: F3 ?: t4 U+ _) v: celse5 ^" P9 n4 m- _; c9 ^
cross_marquee.style.left=marqueewidth+8
9 E3 g8 n7 G4 Y) b8 {
- U3 y3 E$ S( j$ W- b9 I}9 u4 Q+ X% Y* {1 o5 I
else if (document.layers){, a- h: w  {5 V8 V" d
if (ns_marquee.left>(actualwidth*(-1)+8))# I+ A  d9 T$ d
ns_marquee.left-=copyspeed  }' `( h. S, a1 k0 R, {
else
- L9 N4 k( A5 Z! [ns_marquee.left=marqueewidth+81 l1 T- n+ U/ O0 g  p
}  R. w' x/ Z: U& K5 h, ~- L3 I
}9 V0 j! m) ?4 u: R1 A1 m9 r6 w$ b9 e
7 d# `- K6 _, d
if (iedom||document.layers){! c( G* Q" y6 e; M4 j8 B
with (document){" M7 l% P- M' C2 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), d9 C2 E2 d3 O2 s* b! @2 \
if (iedom){
& I' w8 C) w7 i5 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; ^. ]* ~. `: Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 Q+ g! y+ v: f& W& S* l, Y% _# X/ m# T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 ~4 k; b; z* l0 E/ o
write('</div>')
$ b8 `! |! J& D}, m! X) A% V, M' ]; W+ n& v4 w# O% \
else if (document.layers){- t! |: n- e9 B* F0 Z9 q' l8 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 v1 m, W. |" P/ wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). }) p$ D4 f  L9 _+ H. C. E
write('</ilayer>')# }6 r3 T/ P6 u/ X, ^. h9 f% n, B9 h) W/ Q
}7 \8 P9 ?: [, t; S
document.write('</td></table>')" c& s  D4 Q) G: T4 T) v* D3 a
}4 P0 M& n0 A' d. n$ _$ I
}
; x3 b+ q" S' C; S8 H</script>

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