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

|
网页之跑马灯文字特效
//修改宽度
8 Q& B) `; e: Qvar marqueewidth=300" ^: p6 m* s- G+ N- w; G+ ]
//高度
7 j* e2 m1 e6 c ]var marqueeheight=25
" ?6 [% Y6 [) X+ t//速度(1-10)
6 [' h3 _0 y$ z/ O( ~var marqueespeed=3& q* T; ]0 G' L4 q9 m' e4 X
//背景颜色
2 K3 b' E9 M* ?8 O$ L1 Tvar marqueebgcolor="#FFFFFF"
% P) {9 T9 f9 U+ G% o* k' P$ q) p* w//是否能暂停 (0=no. 1=yes)?
5 l5 v0 P0 q/ tvar pauseit=1
% n$ @7 y( o( |( w2 J" m U
* y$ Q+ ?6 ?) S6 I5 H" W//修改显示内容
+ K1 ~8 g; h& _! B; z7 [) |" l0 @$ Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% L$ n4 {; t6 M8 O7 [
* x2 C' C# C) h; X
) |- P3 n+ ~* b
////下面不需改变////////////
: z6 \$ k# G l& m6 L/ b
) {8 y K, U4 Lvar copyspeed=marqueespeed( e" J( P$ O3 a; f' l
var pausespeed=(pauseit==0)? copyspeed: 03 t) Q3 t, N G
var iedom=document.all||document.getElementById% R" m- c; D5 Y2 ~2 X
if (iedom)) ~5 K0 S8 _4 q4 v. c) K* {! ]& ^" q4 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 a; p: a, x; B) i, E
var actualwidth=''
4 W: i3 m; T2 i. ^var cross_marquee, ns_marquee
* ]% |. C( t# N& {" p% g" n- g
3 K/ f6 y- x3 `: }6 p# n0 s! @2 yfunction populate(){5 r! s% E0 }, \( K0 v4 t- m
if (iedom){8 y" v3 Z. m8 l; B& C, w- I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- p( l2 C/ M7 Q$ Q$ [- bcross_marquee.style.left=marqueewidth+8
6 C% X& J6 {/ `+ D9 Qcross_marquee.innerHTML=marqueecontent
, \( S. \( [# y! Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' F: ~, {- W6 _
}
8 O6 r ~8 R! Q% `& selse if (document.layers){& h( \7 ` e% n. u- K( X
ns_marquee=document.ns_marquee.document.ns_marquee2- {2 Y( ] h) v( F5 b- e
ns_marquee.left=marqueewidth+8
+ p7 t' j" i6 Nns_marquee.document.write(marqueecontent)
4 T9 w3 {- ~% s! Rns_marquee.document.close()% M/ x2 S7 n- W0 I7 H, Y) Z. i" `( W
actualwidth=ns_marquee.document.width
# `$ d1 `! b x! A}1 H- \8 p4 \9 }8 q* k8 b6 U
lefttime=setInterval("scrollmarquee()",20)
& r* b2 r6 U J, y7 p}% Q# P0 Y3 b: z) K& l+ ~# t6 O/ }1 b
window.onload=populate
- D2 y( ? Z7 X# h' ^6 {" ]% j# h5 B% Z2 {$ |" w# Y
function scrollmarquee(){5 D1 b8 Q5 ^& H; A- V `/ ~
if (iedom){
" ]4 ?: y' O% k% Y' Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 T% s! f' W. O+ [/ l8 x1 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! ~/ P, a* ^5 _8 G( p1 k
else$ @5 N# ]/ s, h! k5 G; w+ u
cross_marquee.style.left=marqueewidth+8
1 {# \9 g9 z5 N4 P0 I
- K: r# s* n" k8 Q}+ U Q; N# W- x1 F& e; M
else if (document.layers){
. ~1 t, E& I9 H+ x8 F% c! t% J0 bif (ns_marquee.left>(actualwidth*(-1)+8))
8 \% i5 x( ^: Q. b- mns_marquee.left-=copyspeed& t; o! L$ y1 k" _4 {! z5 q. d5 y
else4 P& `4 D ?; U1 d# _8 ^
ns_marquee.left=marqueewidth+86 L2 T9 a& `% ?, p0 ~6 h" f
}/ I! p) D. z* z( f7 Q' K
}% |* k. j Q }3 }% F+ L- P0 i
) S2 t* z" A( [" n% j, W5 fif (iedom||document.layers){) Q% H6 r/ }/ |# @ Z. Z+ F
with (document){
8 b# A& y% U* x; q- Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. `5 [4 Q$ f- R0 l" v0 ~6 {$ Jif (iedom){5 A) x$ X. X2 ]; d: S- e/ h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); B% }# y* r' x( Z! Y8 l, ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ o8 R! j+ T# A* Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, A; b7 {& e/ m3 jwrite('</div>') Z* L) v3 r) F# ` P9 m6 T
}
$ ~1 l3 o. s/ Melse if (document.layers){6 I1 t+ Z" b2 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 k! a- v2 b0 r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" L6 l& O' u, H$ F) z: hwrite('</ilayer>')
( W) y4 A5 ~% y}
+ }% e; E) k- Kdocument.write('</td></table>')
2 w5 u8 |( t% A" T- o6 n1 M& \( u}2 e O& p [1 G- S) T' ^4 f
} o9 f6 ^5 j, ^8 V, V& d
</script> |
|