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

|
网页之跑马灯文字特效
//修改宽度
# U, y# B3 c% D) J: I, y: svar marqueewidth=3003 |6 `% k6 E7 {& f0 J9 s
//高度
# J% }: B0 {& I9 T. yvar marqueeheight=25
! Y5 k. }& t% i; x9 L//速度(1-10)
) c( Q2 k: y. u# K+ Mvar marqueespeed=3
4 w* M G5 U4 v- i6 j }, g//背景颜色
; K! |7 L* \7 I" \9 b! Qvar marqueebgcolor="#FFFFFF"
1 @. m3 R3 x3 d) j# c; _//是否能暂停 (0=no. 1=yes)?
4 Z( o+ s+ D" {1 U0 g: R% Ivar pauseit=18 d2 X; `* v# U H% B% @
) R0 ~2 ^& r4 [# T% m. K
//修改显示内容1 c: x" \0 Q4 T, S E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. I$ f* L. k' B% n$ w. i
. q% O8 w* Y3 Z+ P8 i0 i
6 h6 \3 W% D. h$ }! ^////下面不需改变////////////* \7 U X0 o8 v+ t' M; s W2 G
+ n2 B; _* U4 Evar copyspeed=marqueespeed
5 s* |4 G2 N ^* U5 Cvar pausespeed=(pauseit==0)? copyspeed: 02 X. H: X/ g: D/ K
var iedom=document.all||document.getElementById. B: ?( i! ?% y
if (iedom)$ W+ N5 C& \3 E; Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 h6 j( z" Q: Y6 Q. s+ ]var actualwidth=''5 O4 A# S1 R* `: w: D
var cross_marquee, ns_marquee
# Z0 K9 @% R' `; V4 X3 F+ |( x, I9 j7 X, q" X. m, N4 A
function populate(){
: U7 J8 d6 N4 Y# V1 n$ e. pif (iedom){
$ a$ B* ]6 P3 o# I) s4 kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 \. P; p9 ^/ U5 f/ N0 Y2 M
cross_marquee.style.left=marqueewidth+8
% ?4 `* {: Z `cross_marquee.innerHTML=marqueecontent( M) ?) f: r- F- v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: E$ i) G( l5 }, e
}" o$ @$ P. V$ I/ L0 ?
else if (document.layers){& ~1 m, A$ o, s9 P5 ?& h9 e
ns_marquee=document.ns_marquee.document.ns_marquee2
1 K% z6 I- Q5 V+ ^ns_marquee.left=marqueewidth+8
5 c1 R4 r! }8 e( v' X9 V$ D/ q3 ]ns_marquee.document.write(marqueecontent)/ _" W, j+ W$ {
ns_marquee.document.close()5 `+ g# \% f9 R2 S4 V' n2 Y4 [
actualwidth=ns_marquee.document.width1 B9 t" S: O6 g! _
}
6 u0 T* u0 F/ U- [lefttime=setInterval("scrollmarquee()",20), `4 M" j, L, V* p
}7 h% |4 L" ?* `9 N8 M+ j& {6 U
window.onload=populate
v$ v+ ~4 }. R2 ~- M6 a; z) Z7 x3 M) O
function scrollmarquee(){
8 s0 F3 R) U ^# G& H. Nif (iedom){5 P! H: T1 S% m3 T$ k* U4 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" b! P' F: N& a% N) T4 u4 Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 Z# h4 n* ^9 V$ c6 Ielse/ W, Z$ M! V* d$ f* N% _1 y. U
cross_marquee.style.left=marqueewidth+84 j3 l% @6 G/ o( o
+ v* E/ e0 @$ s% u}
7 X. k6 ~% o0 b: p- Kelse if (document.layers){
v3 A* Y5 A& L$ f/ xif (ns_marquee.left>(actualwidth*(-1)+8))
' P: `" b1 s% ?+ |- Ins_marquee.left-=copyspeed* F, m0 M2 y6 T. X" q: W% A% P c5 h
else
% i8 Z) W# \ O3 Vns_marquee.left=marqueewidth+8
4 U5 x. A+ o' W# j. N0 M}
8 K! y& q4 e3 ?" e( V0 d. Q2 X' N}
) N7 s( b6 S3 D1 {8 ]
! H$ c. N( A9 y. F$ l. U, uif (iedom||document.layers){4 O- E. G9 o7 Y: d, G
with (document){
) q3 f* g' f! {0 G3 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ u$ [) w7 @; X9 S2 N2 u* E5 Hif (iedom){
0 v( a- v3 U% m- B2 ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ Y6 f, v7 L6 t) R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- g* i! t% ~' S. K; `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ d$ q N9 D- m
write('</div>')
" @ m' Q& W4 U( Q& ]}
5 @# a, g! A/ R$ ^& r& xelse if (document.layers){
: _7 `( d' a) h( Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ Q3 r( z/ C+ U; O! Z1 {6 Z8 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) `8 E: z8 J+ {2 H) s' qwrite('</ilayer>')
% g6 c9 g! z- H3 f% b E7 _! O}
. V& n1 [5 J' S1 Y0 e9 Tdocument.write('</td></table>')
! i% O% n. Z5 a9 E1 p}
: c! x U- ]: ]6 O# K}8 b# ~; g6 P- g: \4 D% l
</script> |
|