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

|
网页之跑马灯文字特效
//修改宽度" e) Y( A+ Y; ]9 }7 ?
var marqueewidth=300! ? l9 j6 ~) }# ^% T8 ^" D2 {5 O
//高度* E/ T* ]) }8 x+ R8 I* v+ i
var marqueeheight=25; M; G4 n- R0 ?5 t$ j
//速度(1-10)6 ]7 W0 L, S$ A( o1 ]. b% P" U: j7 A+ g
var marqueespeed=35 N8 |" t. |& W8 y
//背景颜色
6 c$ w8 [; a6 {, x6 Z/ |var marqueebgcolor="#FFFFFF"6 D7 u2 k+ o" [9 G# e- ~
//是否能暂停 (0=no. 1=yes)?$ X4 L2 ~4 j9 `" E# c: P6 l
var pauseit=1
7 r9 s! l, J8 m( C
# `, l0 z9 {$ W/ j$ ^//修改显示内容
6 i0 P& Q" K) s/ kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* `) L/ i; f1 O% C* H# h" L" Z8 ?" c$ G6 f. _# b
3 @4 Y: }* b# C+ {$ Z% c////下面不需改变////////////
. c* o8 p7 V9 `; B, j! i( V' F/ l& z. a. d2 S, h7 h3 O6 c* }
var copyspeed=marqueespeed' @5 l- K( l8 q# d
var pausespeed=(pauseit==0)? copyspeed: 0 j- z9 @9 z7 b0 W# k! v
var iedom=document.all||document.getElementById
/ S1 d' ?' C( k- ?if (iedom)- E7 u. j% P6 Z7 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) f0 b3 K; f* J! p6 g( o( j
var actualwidth=''9 O; i% m3 B3 r
var cross_marquee, ns_marquee$ y9 h2 z- M6 a9 b
8 n( E' t4 k/ ~2 N/ q* ?9 g5 \
function populate(){
6 m$ p& d$ Y3 w: mif (iedom){
, _! E5 X$ K/ u) h H3 P" V6 L5 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 j+ T7 w" Z9 y3 ]! ]5 gcross_marquee.style.left=marqueewidth+8
1 {* ]6 S8 \, M E& lcross_marquee.innerHTML=marqueecontent% R( c* f6 S H6 g( n, e" K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: g: J/ I- K+ t, Z}+ a. d# ^7 O4 t {8 V3 |0 c
else if (document.layers){$ s }) p i1 c: H- f: o. C" p, w
ns_marquee=document.ns_marquee.document.ns_marquee2
5 l% W/ O1 R; t {* `ns_marquee.left=marqueewidth+8& @: I0 ^) k2 M. V- W- C* w- _
ns_marquee.document.write(marqueecontent) ?0 P# y: O, q
ns_marquee.document.close()
9 W0 Z9 @: i. z* K% cactualwidth=ns_marquee.document.width
% K6 E, D* I, E- n}; |! H/ p, G/ _& ?
lefttime=setInterval("scrollmarquee()",20); [# a$ b$ v# l m# a+ {8 f( Q# V
}
, J! w4 D1 a" x3 lwindow.onload=populate
$ d8 @$ d9 C6 R" g# i
$ ^6 Z7 b0 {! b1 S; Ufunction scrollmarquee(){
) B8 G. J% R1 z3 I5 |/ Vif (iedom){
7 w. x8 Z4 ^" Y7 A- R% Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): t. z/ d5 }: ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 u( ~0 G( y4 R3 o) b
else1 g& l. U% T; u5 y# z1 o" ~
cross_marquee.style.left=marqueewidth+8; k) D4 H2 G+ `/ b) a$ m# F1 O- I* ?
' v4 X/ a% J0 \) r# k. P}2 h2 v) f3 ], ~: V7 G% t
else if (document.layers){
6 _& w" o7 m4 A0 m' e% Kif (ns_marquee.left>(actualwidth*(-1)+8))
C) d/ S- P5 b4 Xns_marquee.left-=copyspeed' B1 q0 e1 h; A: U, a1 x
else
0 Q/ |5 O6 f* F5 |8 b# @ns_marquee.left=marqueewidth+8
) B- M1 g* f1 D. h9 B}
) [) Y4 {4 B& g- Q; E6 f}
+ z% M# z( `/ w3 C6 Z6 o5 v1 K, q0 V4 {, M) P4 n
if (iedom||document.layers){! K- w8 k! s0 _. l; g# _
with (document){
7 `# w$ X) E1 c+ j+ f! }/ m! Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 m% S* O) F1 y1 x
if (iedom){5 O& |" J+ G! D7 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') d/ \' o4 S8 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* F( {$ D9 P3 X8 q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 z* u8 ?( E: x! `0 a- z7 j& x
write('</div>')) ^1 T; h' h8 a) w& A
}' W( a& ?' a/ z
else if (document.layers){
8 u2 O% ~& k; f' F% r* mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): Y+ _* \5 |/ f) C$ Y9 Q3 z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( w6 m( k: o4 b$ z
write('</ilayer>')
1 o: M8 W3 P! e4 `}$ b& k" d( r: l& B) I4 T
document.write('</td></table>')# z" G. \* t- a* F; W$ Q
}
" b. M( @: ?8 m$ Q4 S7 ]}
9 j4 \; Q( A* L4 i3 T5 f( X</script> |
|