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

|
网页之跑马灯文字特效
//修改宽度
- h" e: p9 s( Y5 B. x0 S& z. [# avar marqueewidth=300- E/ u" e, m+ D9 R6 B( g
//高度' p- \, l& u7 \$ n3 ~4 Y
var marqueeheight=25
4 c* X& j7 L2 |# Z, k6 Q/ F2 u//速度(1-10)
) h" L+ I3 V% l( A$ a4 xvar marqueespeed=3
/ q( |, n; s6 B; a1 M; |3 K//背景颜色) ?" a! p( H6 x1 ~4 A
var marqueebgcolor="#FFFFFF"
: \) x; x, p& ^//是否能暂停 (0=no. 1=yes)?/ Y8 A/ H ?+ G0 H, C
var pauseit=1$ }% X. q6 P1 A* V7 j; m
/ J5 v# G+ _: [2 r$ W" s$ a0 O//修改显示内容
3 _$ m9 i2 F8 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' H' j$ z4 v, ~7 R8 J
% a8 M: J" i6 Z' W3 I
; X& S& {% q% V, n) o////下面不需改变////////////) y: n1 }' f( i. \; _
3 C/ \* P6 W9 N9 K7 x' Y$ s9 uvar copyspeed=marqueespeed, K6 E% i; y2 g
var pausespeed=(pauseit==0)? copyspeed: 0
0 T ^+ j# A: @) dvar iedom=document.all||document.getElementById r: _* ^$ S) h* z
if (iedom)* z% V, m6 T, s/ E& P* D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 d+ R8 p* ~2 T F9 v, v2 `* kvar actualwidth='': t% W1 m/ g2 s8 ^. E0 I4 g
var cross_marquee, ns_marquee9 X, h9 g+ \% t" D5 ~; o* {
7 _7 Q2 z# u( ~# f- jfunction populate(){; N% K' M. Z0 ?
if (iedom){
4 T. \1 o; V$ I* Y$ d1 v+ jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 O# W8 }. y, q F1 ncross_marquee.style.left=marqueewidth+81 g T- m9 a- Z0 B. L. ?" W
cross_marquee.innerHTML=marqueecontent
$ r' v4 P, r6 ]& `( b" i; F- p, Z) Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# @2 Z: I; o1 U}$ E& N% M u* ?, t) ?
else if (document.layers){& j/ w% ]7 |% ^
ns_marquee=document.ns_marquee.document.ns_marquee2* l. [9 L4 _( t( i( j& u" C9 B
ns_marquee.left=marqueewidth+8 g6 O8 o9 K1 b# [* v# \
ns_marquee.document.write(marqueecontent)0 C$ r- l, ]3 s/ y- _" u
ns_marquee.document.close()
! @# y- V7 d* n# U' m& A& V+ p' {actualwidth=ns_marquee.document.width
+ c) r+ ?3 @5 N; G}
( f" K& e; }* s wlefttime=setInterval("scrollmarquee()",20)
; p+ y4 T( w( E$ O; ?}
" K4 p/ P, D& F( ?; x- n; owindow.onload=populate
& c8 A- }/ R/ t6 j
, s8 F# b$ Y1 g, @7 _function scrollmarquee(){# T1 B( I. |( }9 o: j8 ~6 U) R
if (iedom){ \( l! Y: V) t- r0 F) @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 X3 m! a2 j1 c, j7 Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ f1 _4 W: f( ]. y
else
" n3 p& z1 m) `& ]cross_marquee.style.left=marqueewidth+8
" Y. ^' _1 [2 C* z0 a4 u' }1 M2 r
}
$ P8 V# S* ?) f: relse if (document.layers){
$ S* t9 b4 U1 D. P2 @( g7 A. Hif (ns_marquee.left>(actualwidth*(-1)+8))
( d7 Y+ `" f; q' A2 r1 Ins_marquee.left-=copyspeed
& \$ w' o3 y7 pelse
8 t" e& ]& F- J. ^+ tns_marquee.left=marqueewidth+8: e9 \: c0 W& s
}- w" R! \0 h: W: D) M; _3 x
}1 {& X2 L# l/ ~, U: X
! n' C5 u! `5 U) g/ f; |7 fif (iedom||document.layers){, L4 Z1 T _) [6 m! i
with (document){7 F8 l* V* L( W/ y' b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); g: f* K6 j* M& T8 N' H
if (iedom){
! y" ^0 I$ p" M# Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ u" m% s9 I& [; bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 H9 |! q+ B$ y& Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), z5 G8 v; |8 V
write('</div>')2 N- z$ x' H }( E! ]4 V' i
}9 F* g! V6 h) K7 ~& S
else if (document.layers){3 I8 j: Z% q& |! ?( u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 ^ H1 b+ b- A0 Q" l$ T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& H+ _9 Q# t4 Qwrite('</ilayer>')8 y8 l; h; w5 E) U$ f* p
}
W& |* I& E$ h* ^document.write('</td></table>')
2 B. w3 Q9 C. ]0 H0 v1 p}
V) w; H; c# T Y6 s* s2 J* n}
+ V8 k( m) A+ d" T7 g</script> |
|