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

|
网页之跑马灯文字特效
//修改宽度+ [8 P5 s4 X0 m9 I6 k, c2 m" n
var marqueewidth=300
3 v4 h: [0 a7 L R3 \* J: p1 J3 B//高度
' |3 p, }9 P5 p# T) v T# f' xvar marqueeheight=25" B; |: c0 k# v' k" M
//速度(1-10)
, a; P1 |1 i0 E/ ~6 a; a0 |var marqueespeed=3+ w( n# b6 W, l% }6 o
//背景颜色
: S4 l& C# _* L, ]' w$ zvar marqueebgcolor="#FFFFFF"2 y- {1 t, A6 y' J% O) E1 _# K C+ k
//是否能暂停 (0=no. 1=yes)?/ f" M5 M" F9 ]( u B- u
var pauseit=1- |% G+ H; e. ~; w- Q' k
( n- I9 }5 q- J5 A/ _//修改显示内容
; i! F8 S1 g2 P" Y2 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' X+ F' Y/ j$ h2 z7 k/ X$ q9 ?* ^
- k2 M$ g8 V8 M: t; v
: e/ D6 u9 h( G+ m////下面不需改变////////////
. w$ U/ e" b7 I* d
1 g$ x+ g. U7 F: N" Xvar copyspeed=marqueespeed
& i# N7 K: M& p9 J, n1 s. Fvar pausespeed=(pauseit==0)? copyspeed: 0
# j9 f+ f0 @2 H: t! Tvar iedom=document.all||document.getElementById
9 X% b9 y* w5 g7 i Rif (iedom)
O* W/ W( @! u8 c' O1 p4 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* @* f7 C; E. _! B9 Evar actualwidth=''
, Z d! v$ u$ {9 Pvar cross_marquee, ns_marquee
1 w7 b- w9 U T: {
7 V c# W1 {) i$ D0 G3 _' jfunction populate(){
! ?4 C) C7 V0 |1 eif (iedom){
( V. W! _/ R7 Q/ Y9 l5 u# Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ L1 k# u# |( ~( ^+ U- {: {! L
cross_marquee.style.left=marqueewidth+8
% \3 B4 A' N" R. W! _cross_marquee.innerHTML=marqueecontent& d8 K; G' g5 S1 G# E9 J7 V$ Q" i9 \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ L- i8 q8 @* Q- y3 j5 [, ]4 P0 W}- y: w- | _! E
else if (document.layers){( w- g2 `) R" f* J* u1 U% r7 I3 H, o, m
ns_marquee=document.ns_marquee.document.ns_marquee2
4 H8 C5 N' x) V8 L0 d; e- b$ Hns_marquee.left=marqueewidth+8
* M" n6 E2 L7 B. wns_marquee.document.write(marqueecontent)
( x' u9 q* |+ b1 J3 R9 ?( F5 X9 cns_marquee.document.close()2 \2 ~; }) i3 S- \
actualwidth=ns_marquee.document.width
+ j8 I+ B% w1 B# c7 H}
* A9 I3 N: E. llefttime=setInterval("scrollmarquee()",20)
- z2 H5 v6 L* L3 \, ^}
- I* P( I/ Q! S4 {window.onload=populate
4 J6 L) W- [9 u9 x4 I# r% R7 s5 j, n, q7 r$ z# N
function scrollmarquee(){1 S3 h# { }8 C0 e. O
if (iedom){1 o1 B: J; r0 e; ?! c$ B4 R; v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( ~; {* d0 i% }8 dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. f& _# v$ [- J3 Q" h! p% T" i: helse
# I- O) m% o; f3 _) Ocross_marquee.style.left=marqueewidth+8) U6 E' u( W" ]
* k6 D0 a. Y8 Q; @7 ~& c}3 Y/ R% U) G g( A& a& q
else if (document.layers){
G' Q6 h6 `0 \3 q5 S! b" L$ ^: Rif (ns_marquee.left>(actualwidth*(-1)+8))
7 p2 P( `) x7 c0 j* [, W2 Qns_marquee.left-=copyspeed
5 S; L& [. z+ p9 nelse
& }3 R' y, r v7 cns_marquee.left=marqueewidth+87 Z2 |$ y9 ?3 k. c) K1 _4 O& n
}4 k8 N7 a7 Z( D6 Z. N
}
) d& t# h; v8 L+ j. \1 ?
7 }2 v! j0 ?% X1 Z% lif (iedom||document.layers){
q" b! h* m. W1 T& f4 k3 @0 nwith (document){5 q9 B# e! D" P4 i- ?5 p% M) F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- q: K# \( p( j" g; {
if (iedom){
3 ^' E% E# o; Q- f$ _" d7 V: Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! Z' |$ u( i' ]7 n, p: T& `: @. jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ u) m0 L8 b5 G; y+ w3 S) ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) s; S0 O4 t% i M. Kwrite('</div>')& }1 I* S" m( D
}
; s/ c8 H8 S i# f$ T" ~else if (document.layers){
8 V: p8 h! A" i+ N8 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' o! {' h- @6 i. N5 q. f& P2 n" xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 \# Q7 Z5 y% [! E5 @, `write('</ilayer>')6 v+ K3 h4 ?3 x: I! Q
}
) x; ^3 O% T" z G4 k% Xdocument.write('</td></table>')
7 j2 ? G1 E7 v. W}
: @. C# d9 C& j, \+ h. c}
) ]5 C( U1 r( M" N6 d+ H7 ]</script> |
|