Board logo

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

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

//修改宽度" A" u$ F) Y% h7 _5 ?  L. S& B- P
var marqueewidth=300
0 l6 G( @' w! \! E& p//高度9 F5 M9 U0 {' K9 U7 S
var marqueeheight=25" A+ i' C/ ]# F
//速度(1-10)
9 L( b7 Y* R4 n3 d/ t+ Bvar marqueespeed=3
# F# l  P' d% l( L//背景颜色' t$ B2 R8 k: p% M- c/ a7 q
var marqueebgcolor="#FFFFFF"2 l4 G2 h4 `0 F
//是否能暂停 (0=no. 1=yes)?- D) ^1 W2 Z  M, e
var pauseit=1
% U3 j/ \+ h0 x: n
" x8 x% h: L+ `% ?$ c2 N# Q3 ?) j//修改显示内容
; \# [0 D3 p0 x8 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 N: d. l& K  ~/ h( e% u0 \! F$ r3 E
; k" N0 p  c2 N* N
////下面不需改变////////////* v2 ~: {; ?/ u. k: b
$ T) ~1 r! q& A6 H  n0 j
var copyspeed=marqueespeed5 i4 |2 e% n) b) d
var pausespeed=(pauseit==0)? copyspeed: 0% ~! g1 Z7 N( p2 ~
var iedom=document.all||document.getElementById
1 o+ l$ p7 G0 F- P, k3 Jif (iedom)) }& Y: |( [# F. j1 S: r- o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 F& [2 o5 u, f; z; Y+ Dvar actualwidth=''8 |+ L0 m9 E1 ^1 W; X
var cross_marquee, ns_marquee$ [# d4 X* v1 w0 `5 Q) S: \7 R

( W: u- N3 C) r5 j( w4 d" L' _function populate(){9 Y2 a% K+ C6 m$ q! ^
if (iedom){7 M8 @/ x) }4 j! g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; B4 n+ N% V7 ]$ Q. s
cross_marquee.style.left=marqueewidth+8
- J! c$ M4 c0 T8 E  lcross_marquee.innerHTML=marqueecontent
: Z! C( k" L6 E5 {6 M9 `. k- Z( j! _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 H1 \2 e6 K) u, n/ Q- f
}
  M$ _5 k1 Y9 h6 ^2 ~! `! h5 yelse if (document.layers){, J& L; q* S3 W" B, \
ns_marquee=document.ns_marquee.document.ns_marquee2
! w! H3 K) V' A+ E4 i; c% K3 qns_marquee.left=marqueewidth+86 [6 l& i7 z. q8 z1 j$ p, E$ t3 T
ns_marquee.document.write(marqueecontent)( U+ N/ a+ L" g! ]7 }
ns_marquee.document.close()
+ `5 W; F3 ~3 Z% x; Oactualwidth=ns_marquee.document.width
( l6 S. V: x# P& P. s}
& m& \5 V4 X0 b/ rlefttime=setInterval("scrollmarquee()",20)/ ^# }9 p% {; ]' K+ W0 m6 V: ]
}6 u; r3 w$ B) y( Q; {  W
window.onload=populate" W+ U4 K8 C: E8 _) [, `7 i
+ P7 u" O1 @' D% ]5 g
function scrollmarquee(){
  ^4 f3 h( [8 `( k3 S6 vif (iedom){9 W( v4 H0 s$ b, U% l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; d$ x0 t; V5 \4 l3 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 C. W2 y! @; O: z2 Welse
' X6 C. S- Y4 Q- t, u' h* Ecross_marquee.style.left=marqueewidth+8" |6 t) I  a0 x+ L2 C4 J

1 |3 x) r. |( d: l}1 n- J' E- m" k; M# U' `& a
else if (document.layers){- W3 V5 j+ ~% `! T$ \
if (ns_marquee.left>(actualwidth*(-1)+8))
8 P0 p  A. X3 X; _9 {ns_marquee.left-=copyspeed$ p9 \- f/ ~! S8 {, D, ^- u, p4 b/ M
else5 p  d0 L; {: Z
ns_marquee.left=marqueewidth+8
. A2 d# ~" n/ n7 X0 J5 O$ E}  X0 }7 x. J% V* k
}
' ~3 Z  f" G6 X4 T' x+ H+ i; Z/ ]2 ]' U  W" _/ y
if (iedom||document.layers){
% u% i( H* N' x$ ^' N: i, Xwith (document){8 G; L) o& k3 R+ Y5 O9 \4 i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! t. N0 F* s/ ?, `( O, s$ G# j
if (iedom){
. Z* a9 a2 ?& G% W: C  P4 C3 _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), f) _( o! U$ C; d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 `6 i7 y% e/ f# ~+ G1 P- z7 X" S, p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, G/ T  `' r0 N" v/ d7 twrite('</div>')- f( v6 ]3 h4 l- d$ X+ Z. T
}
8 }, L( o) _6 [- y* I, ?else if (document.layers){
0 T& a3 F6 ~) D; F9 Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 P4 H0 C6 C/ _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) g& i9 i# O7 z) s+ a; F
write('</ilayer>')- ~2 M5 {4 M: [( z8 x
}; |0 n1 \* h: J% T
document.write('</td></table>')
% @& f- [; s' c$ n% k% g}
- c7 k5 f$ c7 Z3 P3 w/ N: x1 j& ^}
  L% {/ G8 h6 J' f6 s</script>




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