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

|
网页之跑马灯文字特效
//修改宽度 J7 g6 m( a) F
var marqueewidth=3006 O5 {3 P1 [) K" n, h
//高度
; R. A( s& W+ p- e3 Q6 avar marqueeheight=25
. ^+ o! s. H; F6 H//速度(1-10)
( P; p6 [) q; }: A6 i/ pvar marqueespeed=3
" o& o6 Z$ q$ K/ l) w+ E% l6 ?//背景颜色
& Y+ Y$ |8 J2 X8 I. k0 {2 Xvar marqueebgcolor="#FFFFFF"2 p) E' h$ u) E4 `/ H
//是否能暂停 (0=no. 1=yes)?4 p% x L, F7 T
var pauseit=1
8 e0 C$ x+ d. N; q1 X. l
/ i- i+ j! y6 k9 r% L) c//修改显示内容
7 i- s4 {- \" f, `2 ]; U& n% Y( [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& N! J, k' |5 M( o0 y- H' |
! k v! ^! p. f' h! q: T; A( p# p4 x. @! J& R! l
////下面不需改变////////////
' M9 B# [( _6 {" F$ l/ r7 `2 Z7 I- O3 K6 q' x5 W2 c
var copyspeed=marqueespeed
( f$ W6 X( N. F+ Svar pausespeed=(pauseit==0)? copyspeed: 0+ M" D2 ?7 z' x7 c
var iedom=document.all||document.getElementById
" x# s" q9 V. ^# k q) ?9 P! ]if (iedom). I3 S' f4 i z t" P' F& r S+ @( k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' L, j& O( z3 M+ K6 Q7 E" Hvar actualwidth=''
4 M* x% ^2 V5 e2 Q, u$ ?var cross_marquee, ns_marquee T, s* B4 ~4 V# F1 R$ ]
6 F8 p0 D: Z6 D! p9 [" Y9 y4 [
function populate(){& J7 s3 e9 ^# a2 n
if (iedom){( [) K3 }& Y3 x8 y6 E0 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 |1 I. z7 O2 xcross_marquee.style.left=marqueewidth+8) v, M" C4 i' p( U/ I, P
cross_marquee.innerHTML=marqueecontent$ H9 L' h; G/ @# _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* X4 n( x+ H ^
}8 g+ L6 k" c- x8 C# n
else if (document.layers){
1 V+ f4 o6 J! l6 Ans_marquee=document.ns_marquee.document.ns_marquee2
5 e- y% H0 J5 M; }+ kns_marquee.left=marqueewidth+8% ^2 Z5 L/ j5 J% @! A! m5 H* C
ns_marquee.document.write(marqueecontent)
$ y& }& q) i+ t2 R) n; zns_marquee.document.close()
/ h- X9 c* z$ ]$ C8 [7 k$ }actualwidth=ns_marquee.document.width
$ j. M. a' d! a2 j8 U& P" O}
$ i5 l/ c0 q: X6 k0 y5 }& a- u4 Flefttime=setInterval("scrollmarquee()",20)5 D2 h3 D+ v" l% O& M& p) F
}6 V- X0 o& I& O) Q L$ D. \! n
window.onload=populate% v; v4 b7 g: g$ o6 r- {
8 {; W# t d& `. H. c0 b6 `/ ~4 L
function scrollmarquee(){2 ]" d$ T: I: I
if (iedom){% j+ i( m# T }5 @4 s8 c" p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& P ?) ?* n2 E8 A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! K2 k7 E7 g) \- n9 |# [4 helse
3 u, [+ J9 |; m H- u* Lcross_marquee.style.left=marqueewidth+8, ~/ z; s' }# V0 S
' Q8 W3 `2 i0 f3 [5 c" U4 I: |0 { |3 y
}5 V6 W6 v9 d5 k5 A5 q5 ?8 M
else if (document.layers){. c' L) [+ U# |4 o2 [" s
if (ns_marquee.left>(actualwidth*(-1)+8))
4 F; d- A# P" Dns_marquee.left-=copyspeed
6 e% m0 Y8 @1 H# Relse7 g$ W; V3 o- l O, H. J' ^# _
ns_marquee.left=marqueewidth+8
6 {6 @5 v1 t$ u}' @- q# e8 Y% n; V. {
}# n d% r: |$ X8 G5 ^) j
+ f5 Q: T7 k% @if (iedom||document.layers){
/ D# y& P! a! [& c* a$ ~with (document){+ w) @) x. @7 }7 z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" i9 E% [+ F! G8 y
if (iedom){
, G8 ]- k, Y* Y [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 L, L9 x8 d/ awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! s' f5 X X3 z6 {5 b' c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), L* f5 D3 \& c8 E1 D0 J
write('</div>')
7 c, k" u1 ~$ s, t}
) B5 E: Q1 ^; b. z; |else if (document.layers){
/ J+ {9 ` p$ v- X* L* ?* V6 v- W& Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 f3 Y. j6 K @% x/ q9 d8 Q* twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* |1 Y. D7 b" Vwrite('</ilayer>')
! ]5 k3 }& |. G: Y}5 y2 s0 }; o4 d1 i% I% C6 _5 q! F5 M
document.write('</td></table>')" y: U/ d0 ^* D9 r
}/ {! g ]( e. b5 r) c P
}
: E8 A5 ?! D+ F* H</script> |
|