返回列表 发帖

网页之跑马灯文字特效

//修改宽度* [) B/ k% c) S1 f2 j& h
var marqueewidth=300
4 n* r* h0 R# D. U7 s//高度- i  v: v, B: w  B! X
var marqueeheight=257 q2 j$ v, [5 g& `9 v5 _1 `- U7 g' I
//速度(1-10)9 X9 t# \( _* o; W. e+ z
var marqueespeed=3
% Z7 o# F1 X6 R& k# S1 C+ X" C//背景颜色
2 o5 V( R4 `. s3 Q8 n4 A+ }var marqueebgcolor="#FFFFFF"
: O4 q+ L* C4 R//是否能暂停 (0=no. 1=yes)?: l& Y( F  `# S) Z* R) k
var pauseit=1
( q. \  K5 I/ D$ {8 T1 R: I" L' C# c/ ^. v3 o( j
//修改显示内容* b6 ~: v5 ^4 X: n6 N" O- R' H: G5 F* j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% P0 F4 ^$ s- {0 ?2 t+ _- W; w3 M0 x2 |+ ?8 M$ n; L/ Q1 u
3 ]7 T4 U2 V5 O9 J& r
////下面不需改变////////////
; U1 v6 S' a+ Y8 ^
& [- q5 K' h# p  nvar copyspeed=marqueespeed
2 Y% Y( m0 z) o3 O# B* D; `! ]* |var pausespeed=(pauseit==0)? copyspeed: 08 R2 b# O* C; V, _4 i& t
var iedom=document.all||document.getElementById& C8 D: z: i6 x
if (iedom)
) v! A$ Z6 Y! v; Z$ A* hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ S* z$ Z$ P+ _/ b+ l* x% I# f* Cvar actualwidth='': v% N6 D1 r: c0 l: P) c' W1 U  ^( U
var cross_marquee, ns_marquee2 s+ c! Q, u9 Y! P

  F% R0 u0 W8 h- zfunction populate(){6 U; Q) ?3 U1 A) I0 D; @$ Z3 g6 g
if (iedom){
2 {3 K0 h; C5 c& ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) g3 u. R; J+ T9 n  y, h- h; j
cross_marquee.style.left=marqueewidth+8
! o1 g& o. I- J% q. B  Icross_marquee.innerHTML=marqueecontent2 f( p* Q6 V( ?8 ]: \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 x$ F0 u2 H  M}
1 l0 o- A7 W7 Melse if (document.layers){
# U. q! @# d4 j: T0 kns_marquee=document.ns_marquee.document.ns_marquee23 \+ O) x4 M( s; a$ p' a
ns_marquee.left=marqueewidth+8
2 D% l; j+ Q$ L; Mns_marquee.document.write(marqueecontent)
: K; |6 l4 r" E8 `) _ns_marquee.document.close()$ y. a: O; |3 d, H
actualwidth=ns_marquee.document.width
3 _( t4 z0 w$ |}$ n' C3 p4 g6 x( l
lefttime=setInterval("scrollmarquee()",20)1 |1 n" m1 @$ M6 k8 q
}
* e: g( c8 l  w  D6 _! Pwindow.onload=populate3 D& x  d' n5 w) G2 H
( X# U1 _- }. |8 n! Z% e
function scrollmarquee(){5 t- m" l$ q! l8 K  G1 O" F( G9 }* E
if (iedom){  U+ x4 \! s/ W5 w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 i- v( Z5 Q' [1 X7 ?, q" Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) U0 ^! a0 a0 Z* h1 {& c
else
* Y# y4 m# Z1 I  U  M/ A' m$ K6 xcross_marquee.style.left=marqueewidth+8# U0 z! t' G1 k- v8 u

* j% c3 ^- Z5 q) V0 b) N}; K+ ^+ z$ x# Q- ?0 ^* p
else if (document.layers){$ n" Y; _/ l/ U0 M* I
if (ns_marquee.left>(actualwidth*(-1)+8))' d% Z& v& {- {" `7 j" Y
ns_marquee.left-=copyspeed
% g% O) b+ p# |$ T1 O0 E9 pelse0 c* `& F, q6 d9 _& f3 M
ns_marquee.left=marqueewidth+8
4 K! g9 C' j: U0 Z# w6 K+ [- A}7 s* S: c1 m7 o8 M
}
  H- y% }& f: D) C1 m9 h' \$ V
" N8 L2 A- h3 h1 [0 `; wif (iedom||document.layers){
+ G! Y# T) R4 n9 e  ^with (document){- Y! z8 \$ u& V0 o- K- J( D* K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. e! ]% \2 p  `/ Mif (iedom){# V, ?0 O0 p3 C9 Y3 V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 i+ c" d2 Y. G0 ^6 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! l: @: K0 {; e4 D9 y3 i$ Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 `/ u8 H+ _" R4 q5 g: @
write('</div>'), }0 x8 x7 {. g# Q  ]  G
}
6 U0 U; T% v; U  celse if (document.layers){; v/ y+ S+ ?7 T6 m* m6 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 _3 b5 B6 Z( P: }: s: ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 Q5 v6 D9 y" g8 o( }* fwrite('</ilayer>')- z: M; u3 |) _# B6 F* z
}
- q& k% E% I) ^" q6 @document.write('</td></table>')
) ^# \, u4 T: z" ]* r" {}
' k- l' f- `, z0 b}
3 d* t5 U0 \; f2 `" t8 _% B$ v</script>

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