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

|
网页之跑马灯文字特效
//修改宽度$ M! W5 C) E3 o! Y* o0 K, O3 U
var marqueewidth=300# }+ |$ [9 F- t% n' I# b
//高度8 |5 Z- y" i" z. k, }# q
var marqueeheight=25
0 T l( l2 T* s5 O H$ e//速度(1-10)
: T% ]# ~* u/ z- Q5 g7 t" @var marqueespeed=32 n; c( ~* s8 ^" C0 P- O
//背景颜色
& |" r; D h" Dvar marqueebgcolor="#FFFFFF"
! L" K! ]. ]1 w% E& k//是否能暂停 (0=no. 1=yes)?
2 t$ \' n, a+ k0 r6 |% q/ Avar pauseit=16 \ K2 |" m( R, X9 S3 f
0 r* V0 s0 a+ ]! w//修改显示内容' n6 T g0 ~' E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# \' ?# O N0 X) X9 o( ^" ]" s) z6 p# s% z2 _" r0 v2 x
5 {7 t0 n6 i8 M( U////下面不需改变////////////% Z! P7 j9 p5 k ~8 M9 J
7 r# t/ t1 U) @4 y) }- w
var copyspeed=marqueespeed
2 P0 g; G. Y9 _( }2 O/ m0 evar pausespeed=(pauseit==0)? copyspeed: 0
7 H" x2 R! H J1 ^var iedom=document.all||document.getElementById$ ~' ]9 ^* Z' j1 n
if (iedom)
6 Q2 l$ b, I7 X+ x% P6 s/ @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): l- [/ `: F9 {8 S: I' S
var actualwidth=''
+ H) K; v+ R1 l! Hvar cross_marquee, ns_marquee/ O, \" X5 E } E* }
7 k9 N1 g6 v3 Z ffunction populate(){8 T- t. S" m* ]6 }8 m
if (iedom){
( }1 |& |! t9 o% Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 Q/ P+ Y8 s. W2 E) L; F
cross_marquee.style.left=marqueewidth+8
, b1 J% K: U) Vcross_marquee.innerHTML=marqueecontent
' E7 ?2 @7 W9 G% B9 Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, z) ` r5 w+ I. W
}
0 l9 j3 [, j _% Yelse if (document.layers){
0 @( N/ s _: |: E( C6 u, v9 ons_marquee=document.ns_marquee.document.ns_marquee2
( j1 i' z# K/ ~) `9 Z) G h' Dns_marquee.left=marqueewidth+8* K# S$ ~/ j& v: X
ns_marquee.document.write(marqueecontent)- z8 g" [9 A& f8 @, w5 {
ns_marquee.document.close()# {* R0 |; H* F- g
actualwidth=ns_marquee.document.width
3 A6 {0 d0 c/ W5 p5 L8 w' ?}/ o3 m, C$ k# y1 y
lefttime=setInterval("scrollmarquee()",20)/ O7 R* k& z/ y7 B1 s
}# H" `1 P+ b6 K) ~( n8 q1 ?9 n
window.onload=populate
0 m9 J$ } m; e
" {( X3 h7 {" [function scrollmarquee(){0 |; c% Z8 C- i& E1 D
if (iedom){
( ^2 k D, }1 h" G9 fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 Q6 q2 y& C i; S+ h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# P5 a& v* M: e4 W- {- `. Welse
/ O. A* r# e, u" Y4 k0 Lcross_marquee.style.left=marqueewidth+8
4 [- }1 g( N/ _) G* d; n: m* e8 [* R, T/ o7 v3 |+ K3 h, [
}
3 E, S5 P1 P6 S3 F- x4 helse if (document.layers){
" u" O$ d. h& _if (ns_marquee.left>(actualwidth*(-1)+8))3 O, t+ F( E9 e3 C
ns_marquee.left-=copyspeed# R& K9 u, B0 n7 Q
else, S1 Q$ L: j/ ^ @2 E4 K& M1 Y
ns_marquee.left=marqueewidth+8
) |- [3 J9 d' k+ ^5 f6 n1 C N+ Y}
7 v& y( T3 G4 J* o! V9 O x, ]}
5 C+ f% ?: e6 E# g* p# C! d, n
7 {" P" t% Q3 i4 h+ R+ I y0 Mif (iedom||document.layers){( r* O4 q8 V9 x& \* A c; J" e- k2 M, }
with (document){8 J8 X8 R% ?+ u, V/ J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 `1 X) |6 M, o8 Uif (iedom){6 Y& c" K$ ]% q# X1 _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 n, ~, J3 `1 R: y0 F$ Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 q# O$ T. D/ G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ j, D3 _0 q' O4 q$ mwrite('</div>')" u8 U. I9 C9 @, c
}
1 X( s% }+ l8 b! n: c; Zelse if (document.layers){! Z2 B9 b+ p7 n. Z H& `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% x5 U1 w& a; \* P% j# Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( N% _! |% l* \5 f( Y* Fwrite('</ilayer>')
0 a8 i8 Y; W0 d: A4 s} w3 E( O! _2 a8 P" D0 a2 s
document.write('</td></table>')# d* c( ]7 p2 Z; U8 n- i- G) z3 Q
}
* d8 d% \& @: n. ?2 p8 W& N! m5 {}
) j9 w$ B* z1 p; r" z+ c/ D4 x</script> |
|