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

|
网页之跑马灯文字特效
//修改宽度+ Y! \2 X& H6 O, t: a
var marqueewidth=300: |% M5 I# y% F0 ^4 w5 L5 _
//高度
Z# I' g; U+ q1 ~% Avar marqueeheight=25
) ]/ m1 S0 X3 B. ^% Q/ k7 [3 O; Z//速度(1-10)
% N0 I5 Z$ O* c3 {0 c! Avar marqueespeed=3
& `0 f% g) C+ V1 }" y//背景颜色
- Y- W: S S2 s/ }" v- cvar marqueebgcolor="#FFFFFF"$ n3 H. f2 R0 g# w7 N3 _& r
//是否能暂停 (0=no. 1=yes)?: t. O* X5 A4 H* t0 [9 d: U
var pauseit=16 q- N: u' V# g7 X5 W
( d/ y6 t% k! b) B0 v4 o' [+ A! D
//修改显示内容
7 w9 \. | ^$ evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Z; Z, u' u: U# M) ^7 o
% T4 D, _5 W' e" a% ^
" E9 {) {: z7 }' W- d
////下面不需改变////////////* r1 l7 g/ c1 K2 G) y1 H, c- \
5 E" v7 c( @4 c9 o2 m0 w5 Lvar copyspeed=marqueespeed3 U: j% c# ~6 K' T- j+ }
var pausespeed=(pauseit==0)? copyspeed: 0
# Q O# ~& e6 g4 fvar iedom=document.all||document.getElementById3 n0 |3 N8 x4 y: Q$ [ r9 z+ Y) \
if (iedom)& N! J2 p- ]. h8 ]- M8 K: B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 s$ j& {" d$ l9 R0 s9 b: L
var actualwidth='' L; ?7 ^. w5 f
var cross_marquee, ns_marquee% F5 y; A; I; o `$ q7 F6 c# P
- ^9 [( x( t, m- G8 N- Z" f0 Rfunction populate(){( C Z% T, J* v. X
if (iedom){
' M4 F& s# `" M3 c# Z) Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 v. B$ z( P6 r* H4 k9 N
cross_marquee.style.left=marqueewidth+89 a. q/ ^& H. A. N) x
cross_marquee.innerHTML=marqueecontent
* w" B$ k0 K: R; Y, X2 u- mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! K! h2 r5 `+ V' W; ~
}
2 ^; u; a* k4 ~/ g+ P1 q: @' ]else if (document.layers){
+ E% z/ s; r/ L4 G1 dns_marquee=document.ns_marquee.document.ns_marquee2
- q, |3 \5 A; y8 l' u- k- F2 [ns_marquee.left=marqueewidth+8) C, f: U8 O' ]% D6 |; b% O
ns_marquee.document.write(marqueecontent)
$ ~+ X) J" b' o+ W9 fns_marquee.document.close()) l% r% g6 `+ F8 i/ }! Q
actualwidth=ns_marquee.document.width
: L* A$ J8 x" |' R' w$ O4 [) K}3 w1 F1 Q# U& g% j; M8 ~
lefttime=setInterval("scrollmarquee()",20)2 ^; e) Q# I* h! x8 t! e" }
}
) Z- I: A* O* @$ Z1 owindow.onload=populate
4 k$ X; c7 j" Q/ d. |6 v, o$ a
G; x1 l$ [) g* T) |$ ?" T: Ffunction scrollmarquee(){# F* f3 Y/ |1 m/ g: i
if (iedom){
" ^- w& i8 k8 J1 t! m' u* Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) M- i0 a( g! {8 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) Y" T2 o2 M2 p3 C3 p
else, U ]2 C2 m3 x0 k
cross_marquee.style.left=marqueewidth+8
4 \' X$ P2 l! c; I
7 ^) L1 b; m; R7 ^}
1 Q2 @" w; {/ z# telse if (document.layers){+ Z0 {7 h( L! }6 ]. d7 j# q1 ~
if (ns_marquee.left>(actualwidth*(-1)+8))1 {( B+ T+ x6 `+ Z
ns_marquee.left-=copyspeed" I% N7 m! l' H0 Z4 @+ b* Y( k0 W
else
1 f0 r: c' d1 r6 U/ a( N, pns_marquee.left=marqueewidth+8
) W0 [& W. ^) ]* X% ?}/ C0 ^9 T( k: H" N* ]7 P
}% d4 v9 T: f( O5 L/ u# n4 F1 k
a7 n, O: p3 l
if (iedom||document.layers){3 L/ y- @7 f7 g1 I: G9 N. m
with (document){
% E6 X( K6 y* o: S& ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 ^/ y0 ]- r6 n, Z
if (iedom){; @! l4 z. f- g7 d/ ` S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* l* a- ]1 a! p" n! l5 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 F" D5 C0 E6 v, G: Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! G3 u. a. i0 k8 w
write('</div>')( Q$ z# t+ B) C* ^
}
5 ]( w$ ]5 w9 x. {else if (document.layers){
- a6 u! }' [( q$ ]0 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 l" V: o5 o# f g7 l, J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( Z( |% A1 A4 G: d4 ^* Owrite('</ilayer>')
7 x0 _9 |' _4 B |}+ M8 ]8 y: [$ }1 i
document.write('</td></table>')
/ R, ]- K6 T$ D" F1 o, d" S# t}
7 A& J) j) A/ u+ c/ V) @9 U}
8 _6 M( I2 e8 f</script> |
|