返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 H1 H  U. L6 [var marqueewidth=300/ b, {4 k0 m6 E8 v' Y/ o; B
//高度; d. s' P9 R$ ]: s) T, j1 u; L
var marqueeheight=25
" V5 W5 Z- w) ?. c4 s( I//速度(1-10)
5 S" H1 Q' T! x5 }% I4 W% H* kvar marqueespeed=3
/ I; W$ n1 h0 w. O3 q//背景颜色+ ~) J$ a2 w* w& Q; c4 w3 I- L
var marqueebgcolor="#FFFFFF"
5 T  K& B# y, t  k2 `( I//是否能暂停 (0=no. 1=yes)?# a6 u0 ?. P7 B! S& C( \9 k5 G
var pauseit=1
* c& `' L" d1 }) B
' q" k4 S6 a" J9 l5 I! n//修改显示内容
& k. f5 {1 w8 |0 ~9 L" d; Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# j1 U! U$ n1 V5 e  @( l6 l/ }1 Z( o4 a/ o0 n
. P3 L& N. g* s$ m) G, ^8 @
////下面不需改变////////////) ^% C1 l% i5 ~2 }, h6 I

  C( l+ {  _( e: {8 f  Yvar copyspeed=marqueespeed5 J& S) k& f; x- S7 C) X# P! K, j
var pausespeed=(pauseit==0)? copyspeed: 09 l+ T3 R* N/ |# n/ Z
var iedom=document.all||document.getElementById
4 `) \# E8 i: C! q! g5 Gif (iedom)$ V( K1 T/ \' k7 u, `+ V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. n" T9 D7 [$ x+ w/ o4 avar actualwidth=''4 q! y8 u3 r0 ?' W9 G5 c$ r8 j
var cross_marquee, ns_marquee  X+ b& u9 o# L% P+ l! f
% W  C( r: [0 C  Q7 }
function populate(){
! V# h! ]5 N- T9 K0 Lif (iedom){
7 I7 o6 g) V6 f4 Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: ^; _7 W( `+ @+ Y+ \
cross_marquee.style.left=marqueewidth+8( ~4 a: k- N7 p) k" a5 H
cross_marquee.innerHTML=marqueecontent' P; f& B8 V$ \0 [) Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 K. J6 G2 E2 w; Y}
- B3 }& n1 P1 k/ I( ^6 W9 Xelse if (document.layers){
2 }. u' U0 X* Ins_marquee=document.ns_marquee.document.ns_marquee27 ~5 L# c# |2 @# A
ns_marquee.left=marqueewidth+8
/ e9 j2 Y3 n' \; sns_marquee.document.write(marqueecontent)
( t4 ]! I+ [0 _  e! g4 }ns_marquee.document.close()+ E2 k; D1 g' x4 [9 n
actualwidth=ns_marquee.document.width
# N" A9 q$ E+ U2 \$ k% c}: v% d/ P" d0 i3 v
lefttime=setInterval("scrollmarquee()",20)* j; D4 A9 W! K: u  r7 c) M8 D) E) u
}9 B: o& u/ B8 _, q
window.onload=populate
0 I0 a; G1 r/ s9 X  Y  Z' ]$ L+ Y' D
function scrollmarquee(){
1 I) b$ [% ^$ U- F6 L0 vif (iedom){2 l3 P1 T, O+ u& P+ J$ n: f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& i* `2 r/ V$ q0 i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! y4 J* ~3 a% g$ G3 f4 Zelse
/ |+ B3 }8 d1 L) \cross_marquee.style.left=marqueewidth+8
% P( R  s% l7 F, S% W# e9 }; |2 I# J+ g0 C6 A8 D; \" _
}
5 V, y, J) ^7 I* s5 ]; a9 W& Qelse if (document.layers){
$ S7 x: z' Q* qif (ns_marquee.left>(actualwidth*(-1)+8)); ]5 o5 N- l( d" {
ns_marquee.left-=copyspeed
& j) H3 U6 X# U( c0 f1 \else$ q& `: Q$ N5 E( B
ns_marquee.left=marqueewidth+83 p& o# l5 n% M
}
1 I7 {2 g' u. A/ i" n5 G- M}
5 {, ]9 E5 L3 B8 y" j9 m& ]
& U9 Y! u/ J- e1 lif (iedom||document.layers){
7 }. ]# L- N/ J0 R  ?with (document){! f  z9 Q: J: d" p1 P( F) O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& w% O* W$ X1 n( h, B; W$ f1 @
if (iedom){8 C) F6 D$ y! E/ A1 ^+ `4 h6 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 R# G' W1 w3 z& U+ A6 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( Y4 d# E% g: c, ?* R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& v: z# z# {8 R+ p) j7 l, t
write('</div>'), N  o0 r9 W  G1 y
}! b/ Q0 n, i4 S+ W
else if (document.layers){
0 s! o$ d( e& r3 e0 n6 u5 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) N) d# F; n3 Q6 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- W1 R0 c( c% Owrite('</ilayer>')
8 ]; J8 z+ X% v7 I. D- H" D}) Q! X, N2 ^: M9 {* n$ d* d) F
document.write('</td></table>')
1 {0 ?- D2 V- k. x/ ]( U}
; {4 d6 c% C: A7 I6 V4 W}* ~# g' r6 ]& [# ~
</script>

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