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

|
网页之跑马灯文字特效
//修改宽度
7 H, }" {- F! Dvar marqueewidth=3004 u. |* X+ g2 ~% i, T9 x
//高度1 t8 ^2 m3 Y+ n6 M1 h
var marqueeheight=252 F: ]. |4 Y6 w2 p
//速度(1-10)1 Y9 [/ \( l" u% z. |$ R; x
var marqueespeed=3
4 V6 G }. c; j//背景颜色
2 F9 X6 m' r C( W, O- cvar marqueebgcolor="#FFFFFF"1 d' {- v, n* @& U
//是否能暂停 (0=no. 1=yes)?2 S/ p0 Q7 C$ W
var pauseit=1
- @ W7 T+ I4 V( A
. v/ h5 o# K+ P* y//修改显示内容
4 d; [, E9 v: ~/ _+ D, D8 c2 I' }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 X, o2 @- }) F
7 X! [; g" o1 j& f# r9 d3 l
3 m& V4 h6 a7 a' P////下面不需改变////////////& | Q* O4 S9 f3 J$ ]
! M P8 j8 |% T8 T
var copyspeed=marqueespeed
: Z( a0 T9 c, d- P! U6 qvar pausespeed=(pauseit==0)? copyspeed: 0/ u6 z7 F/ L: s: m
var iedom=document.all||document.getElementById
$ B# S( t) Q$ @0 m6 Kif (iedom)- f6 y3 u6 O% {0 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 L: z0 h) }& K, q+ H4 qvar actualwidth=''1 l- `9 x# j, k+ R- n3 D
var cross_marquee, ns_marquee
; ~7 }: R4 \7 T# G& N/ W9 j# N8 J! q9 z8 A1 N7 h2 X
function populate(){
$ x2 L( I# ?: F1 I/ bif (iedom){$ e0 {' \- V& p3 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 j7 q! ~ ?* `
cross_marquee.style.left=marqueewidth+8
4 W: i# V5 t0 j- hcross_marquee.innerHTML=marqueecontent5 ?; N" f6 r+ e4 N* g/ Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! ~' j2 J2 [: D. O# {: O
}9 P$ |# L. u$ y/ C7 y$ U& |
else if (document.layers){
! R. E) S) Q. X6 N0 G0 T2 E. Gns_marquee=document.ns_marquee.document.ns_marquee2
3 q/ B% G x) [% h" b9 s S1 rns_marquee.left=marqueewidth+8
; w8 F6 p8 B3 r) Bns_marquee.document.write(marqueecontent)
5 }# d8 h2 e# s2 ?ns_marquee.document.close()4 F* s, [' |$ w8 s1 R7 ^, n
actualwidth=ns_marquee.document.width+ Z: k/ x! E" E+ X2 x
}
' d9 ?' g3 I! U$ Z! B" J, d6 o# hlefttime=setInterval("scrollmarquee()",20)% c* C( y/ x# t
} I7 U4 n1 o5 D% f- l" D7 y
window.onload=populate
9 I% r+ X0 p- q9 h6 i0 \& `9 b
3 _7 A: @6 ^) j' m0 C4 \function scrollmarquee(){1 h0 z8 k7 v" |6 y
if (iedom){* X0 m$ y: y% v e5 B$ v$ {2 d3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% T% c# g) h. Z3 k( `* }6 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 w$ L, k: x) s3 g4 _else9 w0 B* V7 F' T3 H2 t
cross_marquee.style.left=marqueewidth+8
3 @+ y7 Z4 q. h/ }* H5 S
6 O: R7 A! V( T% U5 H# a4 y0 [}; ?( g/ K2 N/ r* ]
else if (document.layers){$ i) I) g: \7 c6 w" E9 X5 T
if (ns_marquee.left>(actualwidth*(-1)+8))
9 d- j3 J% V! n9 F- l3 Wns_marquee.left-=copyspeed
* G+ s/ f, _; delse
% a% x; M) w6 ^4 _: ans_marquee.left=marqueewidth+88 O" }" f4 k# c% S5 V; O
}3 }$ u% i' Z$ P1 t' P
}, E0 {/ Q% T B+ ~! \- R
: X* s6 L. ~# @9 ?2 v: P" O* Dif (iedom||document.layers){
1 z3 p' y6 Y# [5 j2 W- R5 gwith (document){
7 X( h6 F9 r& T& edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 t3 O% H4 R4 L$ S/ Q8 g. O) t/ c
if (iedom){
8 p0 l- e; P) [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# ]2 `) a4 T* g$ j. {7 d) s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, E7 B4 }7 O4 x. A# v6 l- fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
g) _( F$ A" A( W4 Lwrite('</div>'), W: |1 L, Y e6 }: Q$ e
}, p7 N. Z: K& n/ K
else if (document.layers){7 W5 ]! r/ ^: J' k8 O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). P. d i' n& f" D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& d8 Q; |. X" I6 D y5 y
write('</ilayer>')% S4 s! |2 _9 h$ I- A. b
}" \1 m" w0 D7 G1 }7 V
document.write('</td></table>'), u* U0 `- K' M5 _0 f
}
8 c/ R2 p! a& p: T}/ L; I1 t5 L5 E$ P7 `! h
</script> |
|