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

|
网页之跑马灯文字特效
//修改宽度
4 o' e. A# _/ C3 o8 r O- vvar marqueewidth=300% I. l: D+ ?1 U* c
//高度
; a3 ]: s& N* ~var marqueeheight=256 I0 `+ E! N+ \
//速度(1-10)
2 L! ~. h* a3 O9 n7 Fvar marqueespeed=3* a% @% y" z* E5 H& o& z
//背景颜色" j0 c5 ?6 S$ C) q
var marqueebgcolor="#FFFFFF": v- U( [( J! {: Z- R
//是否能暂停 (0=no. 1=yes)?
! p4 V. f4 v" y) S# _' o6 }- \ |var pauseit=1
- ], J* [3 e1 m2 V7 I5 [
8 J8 G8 j! W1 e: @/ v3 B//修改显示内容% Y8 A1 r& |2 B9 u* O, x. O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 Y8 o! t* S' H- L- _2 q {& r" g: }: Z2 ^
7 Y2 Q* n( I8 Y
////下面不需改变////////////% ]4 B. u/ M/ D& E
5 m1 @ S. U( ]9 fvar copyspeed=marqueespeed9 W2 O1 ?. f# Y% L% o+ d- d
var pausespeed=(pauseit==0)? copyspeed: 0
N: |8 M4 T3 Y& \var iedom=document.all||document.getElementById$ P: E0 w- c; ~3 m- p
if (iedom)
9 j* e5 C: {/ o" w/ M. S4 V2 `# T9 ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- X j3 }# {4 j) X' svar actualwidth='': F( {, P! y4 |9 K! Y. W
var cross_marquee, ns_marquee. M& [& d4 s( K b2 a* a# N
+ Q5 \7 I" ]* [- D4 T2 p8 S
function populate(){
& @; K& y# ?0 |+ d: Tif (iedom){
; O+ O6 `2 }6 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* }. D" `" F7 |' q
cross_marquee.style.left=marqueewidth+88 L% d6 t- e4 M: L8 Q2 x f
cross_marquee.innerHTML=marqueecontent% @/ O4 O5 Y" M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& J1 j9 a8 I: O$ ~1 A" i) z3 B}
+ J; s; F X6 jelse if (document.layers){
! s2 }1 Z- l6 D8 Z; Xns_marquee=document.ns_marquee.document.ns_marquee23 E5 Q! S) ^& ^) x
ns_marquee.left=marqueewidth+8" k" w/ M b, u# @7 h: K6 u: e
ns_marquee.document.write(marqueecontent)7 J& D/ u5 J) j9 v
ns_marquee.document.close()
+ e9 E4 N# \+ I! factualwidth=ns_marquee.document.width( g @2 l+ c) ^( e n' |: |5 a) \4 M4 `
}9 M0 K: x$ b* M; c! s6 a8 U
lefttime=setInterval("scrollmarquee()",20)
3 Q7 o" ]! n( d7 p! ^}+ F h: f" k& G1 k& U |! p% x
window.onload=populate
1 t6 b C, Z& Y# j3 A" t' Z& C/ d! G; r# {2 }, s7 d" T1 ?: a
function scrollmarquee(){
! W% W# r# l3 b1 Hif (iedom){
) u4 r1 L2 K3 x& oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: U3 I% D* y! T% y- W2 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! h1 ?3 Q% O' Q% H0 `: s3 o! Pelse
* v% c! |# s6 ]/ B$ `1 u$ E- Bcross_marquee.style.left=marqueewidth+8
h- x9 k; }* k$ [, D% z* f8 R) {. n# n3 k3 o! M5 p
}
# E& v0 G, c; M+ ? `8 Oelse if (document.layers){; G* t' I6 f$ t4 I( R# B$ m
if (ns_marquee.left>(actualwidth*(-1)+8))
5 k7 X, C. Q+ w4 T& Ons_marquee.left-=copyspeed$ ~9 ^7 w2 K4 E0 y7 Z
else
5 A5 w8 @$ T& J {9 c/ Mns_marquee.left=marqueewidth+8
& P" l) m: e0 I; J}: o7 a- D; Q7 b4 K7 N( R v! S
} l' K% N& \( u2 r8 s: [# L0 o) W
4 `& q1 @3 v, I' e% v
if (iedom||document.layers){! T5 q2 Q3 y6 g1 |$ U
with (document){
9 J2 D. L) V% O* \; b3 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% Q; \6 X8 O2 K/ z' ?9 ]7 @
if (iedom){. l' u" i0 y, | S' x# x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- G+ u( t: ~/ w% owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 b8 Z, B6 I% f2 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
@- L: p* a& H8 D% ~- ~write('</div>')4 @% h% e* y) P6 D
}
& u& b" S' X! C+ G, A- r+ Delse if (document.layers){/ P1 f# Y1 S+ I( K- z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 E* k, ?# A: a; d( d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 T, n8 h7 X; M) twrite('</ilayer>')/ \8 R9 c+ W% W9 C
}4 Q9 Q; }+ G1 _" k7 o
document.write('</td></table>')
6 n% N5 f5 R! X1 h2 @ y/ ~}! L9 I J) L, I9 E
}
' [. e0 Z4 N0 ^9 Y</script> |
|