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

|
网页之跑马灯文字特效
//修改宽度1 H. y8 |5 C% x% M# p
var marqueewidth=300' w* t6 T: [3 o3 c% k- g
//高度
# i& d' X( u @/ e5 Cvar marqueeheight=25
# ~+ R% ` [! z% z//速度(1-10): D% O1 b2 O: c6 z! Z0 J& y) L6 }
var marqueespeed=35 T8 X4 q# t8 D) _4 l; ?
//背景颜色
8 z1 b2 G! b( ?: a; d$ h0 bvar marqueebgcolor="#FFFFFF"
! O+ K2 s$ m0 v4 i//是否能暂停 (0=no. 1=yes)?: C5 F, P/ d, e7 D2 n! w
var pauseit=1
6 [/ p+ q ?9 m5 n
; D% }- {! T W& h& ~5 D//修改显示内容
' P! x8 T& I R$ j8 v+ Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( `4 D* { f. h4 z$ }$ m. Y
& p4 h+ g; }' _% E+ ]6 x, m/ Q. Q9 W% A( H$ X8 P
////下面不需改变////////////% {/ F: N; w" S; A/ Q
K( T4 q9 t! Kvar copyspeed=marqueespeed
) [, |3 c& O1 B- uvar pausespeed=(pauseit==0)? copyspeed: 0, C/ f! K0 T+ D* m
var iedom=document.all||document.getElementById0 O! ^0 {. J8 H" V9 p, Y
if (iedom)! A5 V% V8 U: i$ _/ T7 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 f$ _ X/ ?- _ E' avar actualwidth=''
2 @2 o( c7 V$ B" a6 I0 jvar cross_marquee, ns_marquee
7 W+ w* D3 {2 ~- O1 X3 N9 {; j' y7 L2 _- ^- Q1 C8 q" C
function populate(){
: `4 I S- _* _! {9 a6 Dif (iedom){
! L' s* B# G. F3 D5 r4 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; ?% ]+ F; _4 z2 e5 Q* Ecross_marquee.style.left=marqueewidth+8
; T" \) G8 h6 x* l Across_marquee.innerHTML=marqueecontent0 G8 P; {8 F5 e4 x2 S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 x3 Z# R$ x" ^; ~5 x}
, e# B! l; S' A+ o) y! Helse if (document.layers){( r& t& j4 [8 ~& s9 V0 u2 ^9 d. u
ns_marquee=document.ns_marquee.document.ns_marquee26 a) H& G$ [" x/ N2 S
ns_marquee.left=marqueewidth+85 Z' c: G( h- a3 M7 i' b# p
ns_marquee.document.write(marqueecontent)
X0 n9 y) A& Hns_marquee.document.close()8 t' O6 e; V; J/ `7 U* }
actualwidth=ns_marquee.document.width. Z& S3 m$ L& b0 |' W; k3 z
}4 O2 l+ }# J# i
lefttime=setInterval("scrollmarquee()",20)* w7 P, P$ Q1 y; { V) ?
}
% M& ?/ @- w% p/ t* a- j( hwindow.onload=populate9 s: Z6 g$ S# ?# c
2 b! v+ k! j( V- g$ a. @' f/ D0 E+ e
function scrollmarquee(){ _' m6 h9 b, W/ L; h7 G
if (iedom){8 ]5 b& F/ i o" B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), q# J, L% i0 ~3 j: v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: k4 B/ O* d3 x/ r3 }( U
else
) `$ k9 [& I4 i0 `7 D5 Ccross_marquee.style.left=marqueewidth+8) }1 f, T. l) Z' h
* l8 t* I& Q3 ~0 y" U8 Z$ K( m}( a- ?5 w! O6 ?0 d3 L& w5 F
else if (document.layers){: T" C% ^7 j* r1 P2 M9 m0 c
if (ns_marquee.left>(actualwidth*(-1)+8))
- C8 f; F6 @, G: f$ vns_marquee.left-=copyspeed
& P& v8 L7 {8 ^& l& qelse# }; ]8 _& U1 {8 S2 y
ns_marquee.left=marqueewidth+87 H& R. D$ O" r; t( P! H
}
. \5 C6 M6 g' [7 d. C- L" D}9 j% R1 R$ u( F, ]$ C
( U, f$ K' L# O
if (iedom||document.layers){
# T9 o7 E( S$ \/ h+ X: n' \with (document){
/ w/ A0 `8 u% l$ `; W k$ ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 |: Q% l; Q( ?! F9 E! o' N$ Zif (iedom){/ {/ {. v8 Z0 [, j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 [( V; A h" W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 ?. H! E9 ?5 V0 `! `0 zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* r. ?; I5 o6 ~! P! m* k* l6 T: vwrite('</div>')& ~- U! Q) \) B) J, e# H% F
}2 e6 I+ W7 ?% {% N
else if (document.layers){) h- M6 z$ Y) H7 G: G3 g7 D' e( F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ Z: B$ w2 L: ?4 l) Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 [5 {: I* M8 ]$ Uwrite('</ilayer>')% o8 x+ `5 Z6 b, U) J6 m
}
$ I8 B; _8 t! G/ h$ i! A( K6 {document.write('</td></table>')! Y. J9 g' K' G& J8 E8 _% J
}$ Q' k8 i' K( g6 B
}# D. O! _; o: t1 ]
</script> |
|