返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 x' A: |! a3 j; u- c
var marqueewidth=300
1 A- p+ d$ q2 v//高度
  e3 r* D- A  Z6 m! Gvar marqueeheight=25
$ w9 ]  b! j$ q% q# b3 v//速度(1-10); b. P" e) u% T5 S7 c% X; ?
var marqueespeed=3
7 l, p: l- y9 X6 f//背景颜色- D, r8 P2 U- C3 i4 e) l9 I: }
var marqueebgcolor="#FFFFFF"
* q6 b; ~6 V# V% G//是否能暂停 (0=no. 1=yes)?
. [( N' q' K7 ]4 X( G# H. Tvar pauseit=1# h  ^* z! k4 D, n2 `! |

; |. B' |, O3 U( w//修改显示内容6 {5 a, G$ @1 `$ g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ W; n3 X3 ^. y9 F, i- O+ V8 N5 {/ X( n" C  h4 p" @
: ]# [: D$ I/ d3 ^- H4 l# I( y
////下面不需改变////////////5 ]7 o; I$ E7 L+ z
8 y5 }8 M6 M+ r0 a& s3 D6 F
var copyspeed=marqueespeed
- {9 _# u( i1 n' x+ I4 Lvar pausespeed=(pauseit==0)? copyspeed: 0
  s% s& i5 Z# Q( T7 x. S: g9 Ovar iedom=document.all||document.getElementById/ _* a. F- n1 W9 e  j0 P1 G
if (iedom)
3 R2 l- a3 D6 }: h# l" U" Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): E! P! ]4 |, S  P! b% e/ B. Q
var actualwidth=''
( n, m% w6 R$ ~2 m& e1 M; m9 _2 K4 }var cross_marquee, ns_marquee( S( U4 y# {0 I; P3 Q) G

8 ]. Q6 C" r  Zfunction populate(){+ W5 g$ [! I( r4 U) Q( o
if (iedom){4 E, ?) T4 t- z9 F6 N4 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# r1 q9 Q8 o% q8 l2 {. s6 Across_marquee.style.left=marqueewidth+8
: O( C) y1 b$ icross_marquee.innerHTML=marqueecontent% D: I4 i6 y1 e. ]2 q( P8 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; b' Y0 j) T3 D  p- c}
- s8 y. T7 p- V, K: jelse if (document.layers){& r. e) a$ x: [: E, F' Q" e
ns_marquee=document.ns_marquee.document.ns_marquee2
& e8 Q! Z) L/ \& K* kns_marquee.left=marqueewidth+8$ I" v) N. c  t* e! d9 r7 N6 n% S
ns_marquee.document.write(marqueecontent)+ b2 F. I2 \' L, g/ Y* C) \, z
ns_marquee.document.close()0 A' o& J2 w6 A, R0 A  ]9 n
actualwidth=ns_marquee.document.width
, g$ _0 c& {: {! H+ a1 r# c/ y}
7 M9 [3 z& V# {! q0 N5 s# z9 b. Ylefttime=setInterval("scrollmarquee()",20)2 ?! X8 i9 E0 g/ Y, m- y
}8 u" V9 a: S. r8 x4 O2 N! b. y
window.onload=populate/ x: M/ M3 x4 N' P

# L6 h! R! X1 |0 k8 C% N; i) s& Qfunction scrollmarquee(){
4 C0 c- L. w) R  f! [if (iedom){
7 K8 f- I& m" n- Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
  a- v/ k9 ]9 Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& i6 s7 c4 g, }& M$ G- Gelse
0 E, s/ ^/ I4 R5 y* B7 F1 f9 ^6 Tcross_marquee.style.left=marqueewidth+82 @# A/ T3 Y% K( c, f) j2 [

6 n" Q3 F8 P: p: v}: N6 _: \# O" k8 s
else if (document.layers){+ M- c( A. p) G! E7 U. h
if (ns_marquee.left>(actualwidth*(-1)+8))+ H9 l. s9 b# ?. A+ q2 _
ns_marquee.left-=copyspeed
% r* _& h* l5 G8 Kelse; w* O: {8 u/ B; [
ns_marquee.left=marqueewidth+87 d4 X9 n8 z8 |3 G& s9 p$ M
}6 U$ Y$ ]' R& w. h& O. }3 }
}! m% m+ |. ?4 q; S* }

/ _0 l9 F( c! m4 g0 M3 Lif (iedom||document.layers){2 N9 [* G: L& b; y6 `
with (document){
& ~" b( a1 G! l: w/ T/ fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" V5 [& F  Y: `" S' A' W2 Dif (iedom){( {) L+ }! z  d: Z' X. q: w$ i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# Z3 N: z, Y) H; [- H% S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) \8 h! O' e  f5 P6 Y  j5 w3 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ @4 D" y1 Z+ h% \+ \* A- Z
write('</div>')
3 ^/ p6 O3 g9 y7 j- J: y: M}
9 a& I9 d$ D) o( o2 J3 g+ {1 _else if (document.layers){% M& l& h5 @( c: Q! \! X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 t5 L& S* S/ W8 V- @" q0 [7 T1 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 Z% J: Q! ^+ v! X6 J3 @9 Q' Dwrite('</ilayer>')
% a1 ^1 _8 u, h& L5 q! ^& w4 e% L}
- S3 W, ^6 G( x6 }document.write('</td></table>')3 K& @3 w* s+ G. J- F
}* s* N. p/ H, }: I' N5 `: |
}
4 d' E' Y) b+ x3 s% w/ Q</script>

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