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

|
网页之跑马灯文字特效
//修改宽度
* {+ K U0 m0 g" Q! ?: z0 C e" Mvar marqueewidth=300% K- b$ d: ]' a6 O! J, ]1 P5 n1 G
//高度
3 O6 }0 h6 l% ~) Z1 G% {var marqueeheight=251 A* k9 K, _; m3 g4 r
//速度(1-10)* f2 t9 ^4 a, e/ _- r3 a
var marqueespeed=3( j9 w7 O+ |( m4 p6 K
//背景颜色
2 B3 h8 {/ n. Zvar marqueebgcolor="#FFFFFF"
2 ? U$ |3 [4 s! Q7 x//是否能暂停 (0=no. 1=yes)?
! R/ l5 N- F8 a Pvar pauseit=1
) M' i7 t& q* W% C8 q, ?
% G- Q4 q* A+ R" c//修改显示内容+ w) Z4 Y9 [' j! D2 [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 k) X6 s* F0 T) v; n7 t
! i; A' _( N) w
# x& i9 w. r0 M, ]+ i' d////下面不需改变////////////' @3 G# Y. T$ p) D4 ~5 U t
: v! u- v' ?' [3 c
var copyspeed=marqueespeed
" Y) f. b7 ?6 I1 @0 g( tvar pausespeed=(pauseit==0)? copyspeed: 0& j# t; m! d' F) D- e! v H0 \
var iedom=document.all||document.getElementById
# K8 \6 w8 T3 F4 \) vif (iedom)
3 G6 M, a5 S& p, g* F+ I0 x0 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 `% L/ o" R3 y3 }* m1 |. o7 [% ^
var actualwidth=''
2 p: R( ?1 f5 i, Ovar cross_marquee, ns_marquee
' D3 t) _$ H6 g7 ]6 Q5 Z$ H. G4 ]
2 ^4 ?; D3 I, [# h4 X% W0 ?9 S* afunction populate(){& Y. X& r9 Q5 L$ @! D
if (iedom){
$ P) { d& ]' \4 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ n+ B: x. h6 N* k* T0 _1 Y. ~% T
cross_marquee.style.left=marqueewidth+80 ^& g7 D2 V/ \ G
cross_marquee.innerHTML=marqueecontent
' K! i4 R3 s( w8 U3 e1 ^+ Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! G8 ?& b* P' I: ]7 H4 [- U
}0 O6 H6 t! r g# k4 |
else if (document.layers){
% F! \* b" t% `7 F/ C6 |ns_marquee=document.ns_marquee.document.ns_marquee2
' a6 m" ~& ]3 Y( U. E% nns_marquee.left=marqueewidth+8
2 U* Z4 M! [# ?ns_marquee.document.write(marqueecontent)1 j+ `' L h" O, t; l
ns_marquee.document.close()+ w$ p" n& K5 B% l$ R2 y7 ^0 q
actualwidth=ns_marquee.document.width7 P- `3 C3 P2 ^* A& [! p
}
2 T+ d* W: o/ _' V- J, [lefttime=setInterval("scrollmarquee()",20)
. t6 _ j& F" @( A7 m1 Q: E- T( }1 ~}4 }+ \+ i0 m' L+ o9 q, G- Z+ v9 ]; ]
window.onload=populate: @ ]% g6 @0 U- c* Q7 _
1 }$ @/ O+ x' ~
function scrollmarquee(){
& v1 u6 b' E5 {/ w1 R2 Rif (iedom){4 u- A- Q# D& R/ o1 Z w, B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% N$ E. K5 s' `) r# c8 | E* \6 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 J! ^: g; g1 |9 k. Z/ [else( t7 G& T% w0 C- w2 o+ K$ z \4 n
cross_marquee.style.left=marqueewidth+89 T3 o2 X3 d- N
" H7 ?3 b; z M [}
, P/ J% v2 i/ K( G0 D* Zelse if (document.layers){
+ W" m; {, w5 ]: wif (ns_marquee.left>(actualwidth*(-1)+8)): o7 V' @8 g* q: x
ns_marquee.left-=copyspeed3 d. l' m: | B; v' _6 K/ g( i" A- B
else
f! F+ {. o4 Z$ w0 Zns_marquee.left=marqueewidth+8
6 J4 o0 `- |' Q, v" F}0 Q: b, X y: M5 z$ }+ ?
}* X, c3 T9 J/ Z# j( K3 b8 U
6 i& l: j. o! `4 c+ F/ U/ ]
if (iedom||document.layers){9 o' ~, ]. r3 A q3 X
with (document){% W" l% q, U4 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ ?2 f1 h; F! M0 c( @if (iedom){
$ `) d9 T# G- D; O1 A4 e$ t% dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: e8 i. Y: x) y$ k% g% }% Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 `% ?* a% [' u9 c4 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ m' |8 {3 f- x7 U: ]write('</div>')
& U7 U) R; P! ?: `. {! i}+ ], d( X, a: F' Y5 N0 a0 H5 [
else if (document.layers){
+ F" Q, ?& D/ z( f9 l8 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 C0 `/ X* a0 O; J$ j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 m, j3 C" o4 t3 Q
write('</ilayer>')% U, Y/ Z, v7 q) y: A$ s
}
6 ^" w2 {/ o, cdocument.write('</td></table>')
4 {% |/ c+ ~. X! G: V- Y}
% S H6 J% B! q$ @# T6 ?3 A}9 o) j- U: h7 W/ F6 M4 A2 \1 j
</script> |
|