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

|
网页之跑马灯文字特效
//修改宽度
. b" F& w T, Y8 i4 Fvar marqueewidth=300
- o$ M/ ]+ k2 X* L3 M//高度
4 g1 P4 M, u# f% Z; f# B5 S; s* E: c* avar marqueeheight=25
+ M' O: V2 U! V! j//速度(1-10)5 w( a6 ^+ ^2 d) q
var marqueespeed=3
U( ^3 J; x0 O# V% W. U//背景颜色
' c' w! {' X. yvar marqueebgcolor="#FFFFFF"' y. l# G6 v. ]/ C8 `% Y
//是否能暂停 (0=no. 1=yes)?# [+ D; E7 Z# X: e# Y2 M6 z x# G9 _: m, K
var pauseit=1
% M7 U$ u! f( _4 G# h
- @7 j* u% [& y$ p7 D5 A//修改显示内容8 h' ^/ y- z- G# @* P2 H5 E; Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% i; N# {6 }! l
. K) I; B! x7 F! |$ n" X9 `7 z1 u" w) k- a, d, i4 k
////下面不需改变////////////
7 E# v' H$ X# L* C" P7 c2 `' n; S1 R( D' }# Y. s
var copyspeed=marqueespeed. ?- G" }9 b( x1 O6 g
var pausespeed=(pauseit==0)? copyspeed: 06 }) V5 c- X9 c- i$ k2 F3 c" R
var iedom=document.all||document.getElementById0 a6 ~0 r& S" {6 n( l
if (iedom)7 z6 [4 \( B# ~! u) N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ h' k; |$ @% O9 K% f" mvar actualwidth='' j$ K8 P; i- a
var cross_marquee, ns_marquee
( r: T. Q4 r2 u- n5 `2 K) \" `" }( T, U7 _
function populate(){. k( H% D# @4 a# V/ s
if (iedom){5 E3 ~: Z. {8 p b& ^
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 x9 D7 a' G; @ d6 C% ~" Gcross_marquee.style.left=marqueewidth+8
' r" V4 N! [# K3 z# ecross_marquee.innerHTML=marqueecontent) c1 j! ~5 c6 B4 }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 c. X4 h- a. w" M& X
}
s( z/ ?+ i5 y' a) x; Y& g' belse if (document.layers){
" Y' _2 i5 h9 O5 x% W$ Vns_marquee=document.ns_marquee.document.ns_marquee26 i* d: o6 m$ l& n+ w
ns_marquee.left=marqueewidth+8
) b1 A1 F2 V/ R+ B K- u: xns_marquee.document.write(marqueecontent)
) E# J# {' r+ L3 Fns_marquee.document.close()
+ r4 h/ B) c* l, @; ractualwidth=ns_marquee.document.width
' I; K. f/ K) l" O. [}# t- C* I, R/ a3 `5 i* |. o
lefttime=setInterval("scrollmarquee()",20)5 B1 {: C; F2 R6 l; H/ }# U
}) D9 V* Y7 i) c( X6 L
window.onload=populate8 l& b) Y& U9 f& c( d, n. _4 O
6 K; e5 A# Z8 ] ~) n
function scrollmarquee(){
6 @7 q0 O" T, {if (iedom){
7 a8 D/ }1 B6 Y$ Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 \! N3 i5 K: k4 D" P. Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 O+ s4 i! E# a5 [8 E
else' v: x1 q' ~+ e* j' S
cross_marquee.style.left=marqueewidth+89 t3 M# [6 c. z! X
8 ]/ _' h1 e: `3 P
}! a; @+ b: C0 [5 H9 n
else if (document.layers){. f( _& \: C, G# U. C
if (ns_marquee.left>(actualwidth*(-1)+8))( g1 W( F) N% M+ h1 ~4 b* H: e# x! d
ns_marquee.left-=copyspeed0 J% t* U, m X/ v- e" E2 Y
else
y. h5 J; n! X" r* o7 X4 Uns_marquee.left=marqueewidth+8
) Y# N3 M( N2 Y9 ]" A}
7 d1 [8 f _$ W! f$ z# G% b1 q}' n; V# u D+ m7 v
4 x/ g/ r/ v$ t; k8 yif (iedom||document.layers){- t! a+ {2 T# ]
with (document){+ a, Y# h# D, M' P! f+ `; {: }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% `6 m) U- Q' S0 V( ]5 D- }
if (iedom){1 D5 T t/ }& Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 A( _' _0 n4 t, @& l" n- X0 Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ W0 A5 b* m# f0 G% C3 ?) \7 H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
J' f- M+ {' e5 A0 h) x- t: Vwrite('</div>')
' _6 Q* W v; `0 }}' O6 M* m* w4 c k! w e
else if (document.layers){
+ U& d% O1 B0 L+ J# mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), o9 D: f: U' s3 ^& P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): G7 l( v( ^ e; f. H0 E n
write('</ilayer>')4 p$ W+ K0 n% ~7 |$ R" m3 ?/ U
}
) y$ F' R. B& D. b5 q9 Adocument.write('</td></table>'), _ {% t4 J9 i; w1 z( r. A7 _$ c+ l
}% b: E' M4 X2 X7 h; D
}
' j2 F3 [- B2 O. y. I; c: _</script> |
|