返回列表 发帖

网页之跑马灯文字特效

//修改宽度# [; K2 N4 c4 X/ P6 r, n
var marqueewidth=300" {5 F6 E: p2 T( F. P
//高度
  }0 V& a, }- Dvar marqueeheight=25. ]3 n5 o* Z3 C  F
//速度(1-10); r* z/ ^) I) q1 Y8 q( l
var marqueespeed=3/ t$ U, ]4 U, i7 d; o6 _
//背景颜色
% Y9 {2 o+ a; k' j: rvar marqueebgcolor="#FFFFFF"7 h, r  M8 V4 b
//是否能暂停 (0=no. 1=yes)?- g5 ^; h) S# H( b6 d( ~7 N
var pauseit=1
( _/ [1 f) W' n) W6 a4 N5 q
3 H, O) u" B% f8 J5 g; l2 `//修改显示内容% m& B9 s; G$ d& t' k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: d$ P3 l; P% a7 a; [; Q) T( @6 @( D! j9 G% n! `0 U1 r
) g$ H1 x) X7 M+ t5 w) G
////下面不需改变////////////
1 d: B5 W2 @  c) i# G& b7 d/ u( d, T; H% Q. P" j& ~1 B" U
var copyspeed=marqueespeed) |) r) R' M/ D. Y  q
var pausespeed=(pauseit==0)? copyspeed: 07 i( P% `3 G' ]0 I  l2 o  f
var iedom=document.all||document.getElementById6 S- F; P4 P7 @' z/ @3 K
if (iedom); d( k% W  n7 ~" a- L" C) ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 ~* w! G  J' Q8 p+ x7 ^+ E6 z
var actualwidth=''2 N  J  f$ g. G  C& T; B# H% ^! d) I- ?
var cross_marquee, ns_marquee0 \5 W. o" N7 G) s. a2 z% }, m
& `. K) I( f5 F; u) \
function populate(){
0 O1 H" v# k/ W( d) ~6 Jif (iedom){
: S9 j  a4 J4 L& fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( [. W' H8 W- o& j' i
cross_marquee.style.left=marqueewidth+8+ b( U" q7 q. z2 ^2 l2 t
cross_marquee.innerHTML=marqueecontent* R, m" ]3 V! f1 }7 u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 n0 n4 y8 W! ~. G" \: F}
6 q. J  P# Y! e; u: ?/ O' yelse if (document.layers){- j% K: G/ q  n- ~; G5 V+ `0 N0 ]
ns_marquee=document.ns_marquee.document.ns_marquee2
1 Q9 w* v! }, U8 ins_marquee.left=marqueewidth+8
# @) y. W& c7 l. Wns_marquee.document.write(marqueecontent)
' r- a/ {1 B+ v( vns_marquee.document.close()* E) p( s! |7 |6 I, m' n( u! P
actualwidth=ns_marquee.document.width6 N! D) I) K: }' x+ d# G
}! \# `  F; w$ j  k: @# M2 t* {
lefttime=setInterval("scrollmarquee()",20)
) M( i; Y( h/ G4 O0 `& M, X- k6 g}
# @! k* p3 @7 B3 K5 rwindow.onload=populate
/ I) m6 Y8 a) ]& K+ `- J" J6 P: B. g  }9 E  H
function scrollmarquee(){
  [# c$ \; ?. n, X. \; N* A8 wif (iedom){
/ Z3 e/ c; k: s7 U: bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ o" o; @7 }7 Z7 h& H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" v# h7 O+ c; a' J! E* D1 u1 m
else
+ S" a6 U, }% l# E, ?- Rcross_marquee.style.left=marqueewidth+8; @* ]2 O+ U! z. b4 _& k7 }

* }2 L# |3 l3 ?" ?! M/ G$ h}
/ B' h# I- Q( n0 d  {else if (document.layers){# W# Z5 S9 D, c0 ]3 [$ e
if (ns_marquee.left>(actualwidth*(-1)+8))
! [6 e7 o' l/ Q! ]" hns_marquee.left-=copyspeed* V% L' d2 w& a4 e+ ?" D
else* R( F1 l: O3 b; |
ns_marquee.left=marqueewidth+82 ~: s4 X5 R  o
}
& O0 {7 Y8 w. L5 V}% F9 O; t2 j% W& v

& I  ~" w. U! P1 T0 J( G, [if (iedom||document.layers){0 r& o& s1 M- A7 O  R) ^
with (document){
  r1 d6 Q2 ], d; P  b6 L: ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 W4 _: z9 C& Y2 i3 ~: T6 `if (iedom){
; N0 u/ h3 j6 c/ _# \, N( j9 _- }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 O; j4 `5 g% D" f- \& K; lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): z+ w5 O; K# s( ^4 L" B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! j/ G) F# v2 F5 r: Pwrite('</div>')
- b8 J$ q, _, v6 w" W( ^}0 v8 d% i3 }' P6 Q
else if (document.layers){$ [: |' K/ W$ j; a- C% E9 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% S. U7 ^; u- k7 @2 h/ d5 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' P: w! o8 x  U; ~' E+ Q' twrite('</ilayer>')
$ @9 ]' {! {! [' X( c3 @4 ]}
9 b  [. w) D+ X" @( a- m* s% xdocument.write('</td></table>')8 N+ l& T: }. [7 R. D
}% K: |9 m8 ^: F
}
! o5 }* L- K. ~! A( x% [: r</script>

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