返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% }& V% W; }/ `, {4 }var marqueewidth=300/ S6 N# I/ L6 }/ H4 c* \  W5 @
//高度
! f2 O5 c/ Z# {! zvar marqueeheight=253 X  {- s1 c* |* p/ p, \- p$ Q, w8 j
//速度(1-10)
: l3 h+ j! z$ u% L* M' s# o) ?var marqueespeed=3) I7 ^' X; Z& y9 _! R7 U& o. r
//背景颜色
3 o% U  b6 k4 c# F/ p0 Fvar marqueebgcolor="#FFFFFF". I; {$ F: n! ~
//是否能暂停 (0=no. 1=yes)?: P1 h& r2 R2 g7 M
var pauseit=10 \- e8 A: ^) B( b

8 f  [) A% |  B# Q//修改显示内容5 Z9 O% Q; D0 z1 [& Q. n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& C, z& T' ^: j! d) B  Q) B

0 n0 b1 J% y. Q& ?  E# A# \3 |) b) D# t, q1 Y
////下面不需改变////////////& }4 J3 w+ W! V5 S/ D

. X, l1 Z2 A$ ?1 h* hvar copyspeed=marqueespeed
. m" _; h: k# H" h# Cvar pausespeed=(pauseit==0)? copyspeed: 0
' n4 w+ B7 M6 {var iedom=document.all||document.getElementById) b) c: R( O( w: g1 I
if (iedom)
+ ]* A1 D8 q8 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  f3 M3 G& e# v1 x+ U
var actualwidth=''! y- h' `0 S1 I; E
var cross_marquee, ns_marquee
; R& `2 d. o. u( j# `
: ^" b% N2 l4 D- Qfunction populate(){
0 H- @. {5 T5 C) d% [3 _if (iedom){. R( d. o. [) N% v0 x/ U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( U2 C8 V: R  @6 `
cross_marquee.style.left=marqueewidth+8
/ Y  r9 o' j3 t3 }& E- Bcross_marquee.innerHTML=marqueecontent7 Y4 V$ R4 O; K" b& ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( i8 d: C6 S2 l}" f% X7 L5 F# y8 L' Z
else if (document.layers){
- ]: p! E# l$ @7 ~7 W/ R1 Jns_marquee=document.ns_marquee.document.ns_marquee2- F5 Q0 Y( H3 h: h; r. z+ x. h- u
ns_marquee.left=marqueewidth+80 a  T1 o5 v4 ~; i$ V0 h7 N( ?+ I
ns_marquee.document.write(marqueecontent)
2 r8 e6 M( k% p( O; Y3 Lns_marquee.document.close()
/ v: @" Q. v% E9 M/ C' Pactualwidth=ns_marquee.document.width! H; A  _6 F0 ~4 i- i1 n
}
* _1 g. F& j2 R& T  S6 j* Hlefttime=setInterval("scrollmarquee()",20)
4 B. Q$ j0 Z! l4 x$ Q  Y3 h}
5 a9 n# d( }+ ^$ Y4 p. ~* w( n! ^window.onload=populate' V+ k- \: }, `0 c6 O
$ L) `: v' v- V' B+ ]$ \+ E
function scrollmarquee(){+ E3 y; T3 [! ^# s
if (iedom){# f2 p" V! D2 [% V8 g
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 s+ @4 ~( R$ a2 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 J! E" J3 q  R9 l$ d; q' d1 `else
3 j+ A6 O, A! kcross_marquee.style.left=marqueewidth+8. R0 T4 ]+ H3 x

8 y/ `+ W) n# J1 M9 x}+ W' K4 [% Q3 N8 x# }. B: U3 U/ _
else if (document.layers){
$ U$ ~) L. L- \" q. V7 Hif (ns_marquee.left>(actualwidth*(-1)+8))6 O+ i2 \; T9 {5 ~$ |0 I- [0 c: A
ns_marquee.left-=copyspeed
% o$ c9 }! r( A! \( p  Q7 f. Uelse
3 {/ p) z6 ]1 L# }+ S3 |ns_marquee.left=marqueewidth+8
0 ]" p" @! q- ~8 v}! V( P1 e  [. a+ h$ B  r6 F
}
  {' n1 ~! _  z- }' H& A: Y8 r. Q8 E7 o  `: |! \
if (iedom||document.layers){+ y" B0 i. ?" U/ I
with (document){8 q' V& e$ |/ p$ I! {& [5 u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 x' j7 E3 W: ]) j" Q+ b
if (iedom){
: Y# d3 X; E5 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( @$ l: h' p! }! @% L3 H& h, Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 X5 E0 D* x% D8 [3 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& S8 O8 W4 x% M
write('</div>')/ V2 A+ N0 F9 Z5 g, i
}/ T  D9 a/ ]( F, ^  b
else if (document.layers){
5 ~6 }& q, x& _- `8 K2 y. Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% |0 c+ m1 f5 d5 ~7 M/ t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): O+ r& x" C8 H3 |) Y5 g
write('</ilayer>')7 [6 M8 _: W" A* f
}- x+ m: S& ?/ b9 e# e& R9 A
document.write('</td></table>')' R) G; O" h8 M7 \( V
}
, d) M" t; d* j' [+ S0 l/ G4 \}- V- T) T$ W( k" @1 A% `" _2 G
</script>

返回列表
【捌玖网络】已经运行: