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

|
网页之跑马灯文字特效
//修改宽度
0 s0 ]; `" L" F8 o& a/ F+ Evar marqueewidth=300
' w0 k4 [7 v0 G+ i T//高度
, a7 S0 _) V0 |/ K" bvar marqueeheight=25/ e; j: s1 W4 T
//速度(1-10)
. v/ S: Y* D8 l' R8 t5 D( }var marqueespeed=3
0 u/ E2 H* v4 c/ n//背景颜色
+ J6 {/ A! {7 wvar marqueebgcolor="#FFFFFF"5 a) K) U& ^- i. R" j
//是否能暂停 (0=no. 1=yes)?
' [7 v( B$ E: G( X* k2 ~var pauseit=1 [9 w+ G1 A9 D! |" S
/ _* {5 L ^! ~" W7 E! W//修改显示内容6 C4 V* E8 O. _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 r. C* _' N0 Z
Z& i1 H* P3 J; x* }; F- X! W) x0 M6 j, G. I0 j3 ]
////下面不需改变////////////; X9 l4 _, B4 M' J1 ]7 [" y
% v1 U' g4 ?/ C$ }
var copyspeed=marqueespeed
1 b* i5 {, `& t8 k# Mvar pausespeed=(pauseit==0)? copyspeed: 0
& X$ Z. @7 r1 S8 {- V% mvar iedom=document.all||document.getElementById6 p! Z3 g7 q+ p& T* G; G" M
if (iedom)0 r% u$ C) y+ p3 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ C( U7 w+ ~# V `% {6 U! Q
var actualwidth=''+ n% T& V, j8 u W6 R' W. T
var cross_marquee, ns_marquee
: N& P/ G; P4 |9 ^" p
8 R' e! S/ l6 e ]/ qfunction populate(){
: E! n. S6 V1 X$ f' \% L1 f8 qif (iedom){5 v2 U. k( G, Z; L5 h m* h9 [# Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 c) p8 V9 h; `6 p3 Fcross_marquee.style.left=marqueewidth+8/ b- n6 ?6 r p
cross_marquee.innerHTML=marqueecontent6 R! E9 w) o6 U3 s2 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; ?) l* ?: c( k- y5 O& r, f- }
}, t3 N8 a8 v* O X% v) J2 \! O# j
else if (document.layers){
% V( I: {* x |7 ~# b+ mns_marquee=document.ns_marquee.document.ns_marquee28 f8 s# A7 g J9 q0 P* {
ns_marquee.left=marqueewidth+8
% v( [: t* Y0 |, C4 X! tns_marquee.document.write(marqueecontent)
, V4 D! s0 _- k! [: }8 X" a8 }ns_marquee.document.close()- m8 d3 h! K6 ]6 E
actualwidth=ns_marquee.document.width
M" a0 j9 @+ P! T}8 f# y. E6 X! V5 l' `% s
lefttime=setInterval("scrollmarquee()",20)+ H- D1 I2 x7 p* ]7 `8 ]
}
2 P0 D6 x3 i4 j. V+ @9 cwindow.onload=populate" y q# I$ J# ^- j
7 U, L8 R3 E& Mfunction scrollmarquee(){5 l+ u3 ~9 E; D7 w$ U+ p
if (iedom){
- i* W! w% P4 Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 L8 T1 a8 o+ ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& [! `( ]$ ]5 G
else" y0 D4 Y( S# J+ Z* T2 V+ B# K$ }
cross_marquee.style.left=marqueewidth+8
: B3 M( U' t" g% h/ r
& p) M- F: t& c* A1 U/ H}
) s" V9 e! J& u# G4 `, f& N* qelse if (document.layers){
* T# t# w/ l) V$ ^# R! U8 G# P+ ~if (ns_marquee.left>(actualwidth*(-1)+8)), y& n+ R G+ B, \
ns_marquee.left-=copyspeed
5 B( n+ z2 |$ m- U1 N H6 Nelse
. W4 p0 H/ K2 M H& R3 |ns_marquee.left=marqueewidth+88 \, K0 r3 U# p& P4 Q
}
6 y3 z- E+ W8 A8 U}. N4 j0 {3 U8 S; b
# F! M$ Y" C3 _9 k" f* ^
if (iedom||document.layers){1 w* s8 b- L8 @3 o' s2 u1 B5 W) e
with (document){1 k( W" E' c; b, M' X g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ Q) Y1 \; G" W: ]+ Z
if (iedom){: F8 G G7 F5 S. G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% Z6 J& l0 ?, U0 R" c( xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 I# q2 u% r1 W5 s- f1 Y( ^/ wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 h* E+ M4 s& k; F
write('</div>')- w$ v/ C* r; {( ]8 H* m0 O3 {
}
# b' ]. E+ ]: T" `else if (document.layers){
* Y' ?2 k0 A1 R0 S3 U- N5 p9 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 P* |3 k- ^% }: h- Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" M. a" m# U/ [) c3 j
write('</ilayer>')
# S! b5 O# \6 j. i}3 [/ m2 h- o5 x( g/ G! _
document.write('</td></table>')6 p: P5 L1 `8 n% E* T; o
}' A3 C* h! k" i g7 {7 u
}3 |" c$ h, N6 d) ]% d+ {/ \
</script> |
|