Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
' n# P* A! u4 _' Lvar marqueewidth=300
$ ^' }3 L  f- R//高度& G1 N" y! r4 |: O( J
var marqueeheight=25
: G$ t6 V* ?" @//速度(1-10)3 d$ W& Y: Z5 a: E! ^! S6 Q4 @
var marqueespeed=3
  M1 C, I, A0 P, d6 X//背景颜色  [& a1 d" u  V/ `4 S. D5 W
var marqueebgcolor="#FFFFFF"
' w+ x0 T. b+ ?- @! p" _/ \8 c% k//是否能暂停 (0=no. 1=yes)?
' p- ]. N4 ^: S2 L9 D, dvar pauseit=1
  B3 R# W2 p. w; r: Z7 y2 @( E& R7 c
//修改显示内容3 G4 f: c+ T) x, u5 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') o- x; ?% {9 S! h6 C3 Z# S
3 ]( \; F0 W) E/ N, |

9 ?" t0 s2 f/ e5 P) d& e0 p////下面不需改变////////////* j: {* ?) n* y' X9 M' D& C

0 I( j8 w9 B  D. ]6 dvar copyspeed=marqueespeed
9 Z: o$ x' T0 a# v5 Qvar pausespeed=(pauseit==0)? copyspeed: 0
& N8 o+ O% b# T  \) u# p6 gvar iedom=document.all||document.getElementById$ z/ r: _1 h5 S+ u+ e. ?
if (iedom)- ]+ d  [8 k$ i7 i# I& p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 T2 N, g4 g% U- a0 Hvar actualwidth=''
, ^: n* ~9 T4 S/ g# n  Nvar cross_marquee, ns_marquee
* p9 s% {5 A# f# }5 k0 h+ K4 T% P
. E+ b# R' s8 ffunction populate(){; J/ N. X3 M6 C% g1 c( V3 s4 \
if (iedom){$ l: q7 j/ W8 H  d% D8 w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& b* F' S$ H7 Z9 }
cross_marquee.style.left=marqueewidth+8
3 T- B; \8 q6 s" V  Y7 a4 Xcross_marquee.innerHTML=marqueecontent
- S/ F& e0 q) e' jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 R! n7 z  F, c
}$ n$ R& x# j; ?! U$ u: l
else if (document.layers){3 [, d- O0 k7 g6 @) {' `: }$ D
ns_marquee=document.ns_marquee.document.ns_marquee2
! e% ?$ r6 h& q' h! Dns_marquee.left=marqueewidth+8& P/ F( d9 h0 j& _: R- s. P
ns_marquee.document.write(marqueecontent)
8 P8 W% W9 ]4 A. Q  M3 Uns_marquee.document.close()
; A2 e% X" K  f' U6 ]% Y# q3 bactualwidth=ns_marquee.document.width5 ?) E6 E1 V# ^, u7 K
}, h( k7 |% v' q. c  k
lefttime=setInterval("scrollmarquee()",20)# ?5 C( a- y% W1 Q+ i! O% z$ D3 z# ?
}. Y; C6 |% B" F  K0 q. s- V
window.onload=populate# w2 U4 j! b& k& C  k5 D5 q
8 B0 M' M3 x( C4 u3 A- x  o, w8 d
function scrollmarquee(){
# B4 _2 i1 z+ ~- x: }5 ^if (iedom){1 B2 z6 z. S4 N7 e' M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  F" T: U& J% ^! Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ `7 S# j* l3 F. [9 D: v
else
# ^6 y" c) [0 ~( l: Y* G' ?1 ocross_marquee.style.left=marqueewidth+8# H+ V  a$ R9 G5 B% K

; o; _  m0 V: V, ?' G% T}+ Q& K" m# i" u& a5 w  b
else if (document.layers){8 }6 E+ G- Q0 }5 g) K6 d4 l
if (ns_marquee.left>(actualwidth*(-1)+8))+ @5 L: @! W; Q; z7 X% j* t
ns_marquee.left-=copyspeed( g# x6 r) q: y  U5 a; e
else0 ~5 B' g6 Y- U
ns_marquee.left=marqueewidth+8- m" _( A9 H# C# [
}
9 @* b; @4 J* E, K9 S2 M}
& I- }; Z* I9 ?( g: u! v/ H
8 g3 w4 h" j( P$ L9 Gif (iedom||document.layers){0 C/ l; |/ p# x- J
with (document){1 m8 f- y# V$ l  {8 Q  G. Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 n1 c. b0 x& F' e+ X( s
if (iedom){
) [9 I- I6 d! |8 S. y" p7 Z/ s) ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) I# R* e4 q, U5 }" O+ V" B  Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* e( q; l3 x; {5 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! W- _. ^+ a7 F1 Z$ awrite('</div>')
8 u( l. ^3 u2 R" b9 n}
  p7 T: O' n# X+ j9 F5 i1 e1 belse if (document.layers){
1 \" Y' I2 \% s- ^# |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! a% }" a% I6 S+ c/ S3 H4 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! K' m( M, G" S7 hwrite('</ilayer>')
7 t" N1 k. C# |! G7 e  c}' ^4 c' H" k4 B0 g( o' M
document.write('</td></table>')6 [4 y9 x- g8 {5 F. Q& K1 ?
}
  ~$ W; ^1 I  V; @+ E0 T}
" d+ k, J6 |$ S- ~- @4 G. p</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2