|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度7 S+ ^0 n: Q- h# a5 ~: M
var marqueewidth=300
# B+ R- k7 c: L//高度- v [2 R0 |4 l3 B7 a1 {# Q
var marqueeheight=25/ A2 o) n' N! u D& ?/ W8 H, C
//速度(1-10)3 A* A$ O# g8 E8 q
var marqueespeed=30 f( q& e+ W/ v6 W- N c0 ^
//背景颜色
$ e2 `" N5 Z! Mvar marqueebgcolor="#FFFFFF"
8 g7 X; N! [. `% H//是否能暂停 (0=no. 1=yes)?
% `5 i, w D0 g \* F$ `var pauseit=1: K0 ~9 a- w; S5 _* o
+ o: H2 z: M1 J0 u
//修改显示内容
: O: ?2 P5 P8 P5 jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ L5 ~/ R' E/ o7 `+ ?+ t* U
/ C8 g) @- k1 c) ]4 p5 x7 e9 {/ f+ _6 ^
////下面不需改变////////////8 A- v [ y) `$ f* B( z- t0 f
9 \' P/ n9 T$ f$ ?' ]
var copyspeed=marqueespeed
" v, r" {5 n% g+ @6 T( Fvar pausespeed=(pauseit==0)? copyspeed: 0
' A! T0 g4 c6 i# J e7 q) kvar iedom=document.all||document.getElementById, b9 |: H$ P# P6 b1 }7 B2 V' v
if (iedom)
- ^& H# _2 p; G- y2 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 m! j/ F# B( r8 W
var actualwidth=''
" ~2 }* q% e' \' Z+ h4 S) evar cross_marquee, ns_marquee3 @/ r3 e. _! O) C( T
: D0 t) s+ ]: H" r8 e: X+ _# i
function populate(){( u# V9 h* ]0 @4 v
if (iedom){
+ Q; P l }' w3 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# s. Y( [: }/ L) ]9 i3 `2 j
cross_marquee.style.left=marqueewidth+8
& t9 X) x# B' [! {# f. i: wcross_marquee.innerHTML=marqueecontent
$ g, N7 q1 y# Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 \3 x/ X9 Y7 N+ e; C
}- M, l0 o {* [) ~ ~" X1 }) H
else if (document.layers){
- M4 u! N1 J% e, P, U) ]ns_marquee=document.ns_marquee.document.ns_marquee2
! f; T. k- M% E( P4 c! ]% xns_marquee.left=marqueewidth+8: `' c0 `9 P+ U+ E
ns_marquee.document.write(marqueecontent)
% O4 Z( Z; `/ C( x( dns_marquee.document.close()
% _, ?2 {( W6 Wactualwidth=ns_marquee.document.width) k/ N9 J# e# s/ ~
}& d# O2 `' F0 U3 v( w& w
lefttime=setInterval("scrollmarquee()",20)5 e: b" M' M# r, M
}
& g- X$ c' j( H! l! bwindow.onload=populate* ]. P7 `, f- n& U& P6 \2 p
6 Z$ l+ Y$ l! V q
function scrollmarquee(){
' n- r0 D; I V: t$ A. v7 _if (iedom){
' _5 L+ C. _: x' M3 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 g m7 W6 ^: _& Z" l& ~# Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! I- a7 ]' x1 O, z+ u( m4 g0 K
else
7 j5 D' W1 R+ X$ N7 Pcross_marquee.style.left=marqueewidth+8
! S6 j% K9 C3 ~+ T$ N7 K! A6 C
; a" L+ M2 s3 k" `4 E}) D" }0 g5 P9 ]; ^% F% N
else if (document.layers){' o: `* U7 U0 y; T
if (ns_marquee.left>(actualwidth*(-1)+8))
6 X8 V8 p3 {, ]$ Xns_marquee.left-=copyspeed
$ p7 n# n( |; I- j0 helse
$ S. i/ a, J c, C" j, Hns_marquee.left=marqueewidth+8" b( ~3 O* B6 Y. i7 `0 }' j
}
! j2 O6 F' Q* k& w) n# d7 ~}' f* |. A# n$ P1 {! O4 K; m1 Q
8 y1 f% P' X9 o( O6 x- `
if (iedom||document.layers){3 x; z9 N- b6 e6 j+ b) V
with (document){
5 } M0 s- i7 L7 V) f% }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ n) V/ m3 J* `8 D1 m& K
if (iedom){
* _& f& ?9 [/ Y, ?9 G; Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# a. ^+ h3 q5 J7 a, p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); G' P6 I) ]3 n
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); J a0 f! x m' _4 e
write('</div>')6 l- s& y: [: P$ s
}5 f: [& f: b5 V, ]* ~# o8 E
else if (document.layers){: e O, [6 g; ]- @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 V- w( k6 [0 V- x7 b1 Q- d& \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! |) r* I% t8 \3 G4 T5 C7 owrite('</ilayer>')* `+ O$ Z. }- J1 y$ j8 ^1 H' [
}
5 u" ]6 k2 B' {6 s, Ldocument.write('</td></table>')/ Y9 x, U: \3 j( G! J' c u' a: m
}
, @" l' l: j! s. u/ x8 b}6 B( X$ l# j4 n" L" t. ]
</script> |
|