返回列表 发帖

网页之跑马灯文字特效

//修改宽度# F7 n, B# c9 J6 j, l
var marqueewidth=3001 @' Y& R# A2 D* O+ o8 x. X
//高度
$ H3 `$ n/ u* U' kvar marqueeheight=25
8 f5 a- n( Y. S8 F: q3 N//速度(1-10)
3 b7 l1 R1 i; E- N3 ?4 X9 {var marqueespeed=30 d& J' |. K* M* L
//背景颜色
/ A6 h. w: p( m0 f7 f# rvar marqueebgcolor="#FFFFFF"
6 W2 B7 A+ Z2 {2 r//是否能暂停 (0=no. 1=yes)?
. i' ?' W& |( F6 G1 avar pauseit=1
+ T6 E' w& t; P3 F
$ ]2 T* M2 P9 _! j$ M8 b1 J//修改显示内容5 ?4 i2 P4 N! U: O2 Q/ p* w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' O1 t  x. K- Y* X. v0 _  I
8 c& ~  y8 \  h
, t- T% g7 ]" P- J' \# u
////下面不需改变////////////# Y& a8 n/ Q  Z0 C8 o  x9 U

0 g% Z! X2 w/ L, V& p8 r* Svar copyspeed=marqueespeed/ R  y- O# d1 ~" G+ B  J1 P* W  d  M
var pausespeed=(pauseit==0)? copyspeed: 0
5 s5 y: ?4 c0 f9 c4 W7 h, ~) Tvar iedom=document.all||document.getElementById- M6 d* r2 f. ]1 S. B
if (iedom)' R  M: I' \; h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 l* ~: s& M. @% ]3 Y1 U
var actualwidth=''3 C( \/ O! ?' p$ Z3 W
var cross_marquee, ns_marquee
* H5 a  x3 T  V! Q9 F
" p: P+ U! `7 Q0 p2 [$ Hfunction populate(){
; ?- Y8 U. F. g" k; Kif (iedom){, ^/ E  P& }) R! }; E2 Y' u5 }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 _' O, m7 V5 W" t) C
cross_marquee.style.left=marqueewidth+8
; ~; G4 ^; s* zcross_marquee.innerHTML=marqueecontent" x$ |& Z# s  [: ~9 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 |/ M8 B: ?1 m. Z% n8 m}: t+ W7 G" p' _& t0 J
else if (document.layers){
4 o+ H/ @5 q8 vns_marquee=document.ns_marquee.document.ns_marquee2
% N5 T+ _$ _$ `ns_marquee.left=marqueewidth+8
1 ]+ }; j  ^6 mns_marquee.document.write(marqueecontent)
' q" [3 k" L; x3 f+ [( i' P9 ^. k( Bns_marquee.document.close()
. A' c% B1 b, f- Nactualwidth=ns_marquee.document.width, t. L1 R  d7 s# c# S' N
}* R& Q5 N& q$ h5 x9 C0 i; T8 B
lefttime=setInterval("scrollmarquee()",20)
' O! [7 p' x, ?}
; k+ F1 Z" ]: @window.onload=populate
+ i. O) o# h0 _3 d+ E+ A# o0 p9 W3 ]; E
function scrollmarquee(){2 N# }& W9 b# U4 q& @
if (iedom){  M; i8 \; b, u  f5 X) C* y) h& [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 M* P2 @8 c+ ^) {* O! ?2 Y( b( ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" h3 ]3 G* `: c, w, D1 u
else
7 q% Z. W+ @; e  R- @5 T+ M% q+ bcross_marquee.style.left=marqueewidth+8& t5 S: u& p9 N; m4 u
" w! d  w1 B7 A# c( C( t9 }# X7 N
}
, V; r7 ]3 E. Welse if (document.layers){
& o; N' b" Z+ I& t3 a, cif (ns_marquee.left>(actualwidth*(-1)+8))  O9 {+ l* m  ^( N8 b$ J! q: }  X
ns_marquee.left-=copyspeed0 U/ [. e* j) R/ @* i( M$ S- z
else2 U$ w9 q1 s; r& K$ P8 p( _: c
ns_marquee.left=marqueewidth+83 _1 ?3 J& R4 d9 m$ B
}
: A6 m+ }  e( _; {! W0 `, ^, m}
6 t% P+ Q( r' {/ U  s- z# S: D* b5 E) z
if (iedom||document.layers){
! k0 p7 O; H. {2 C# n) qwith (document){( q4 x9 Z0 M) T' p+ E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 T, @6 N/ [( x
if (iedom){, W- A' d5 \$ F- B/ b, h9 W' j' k5 G8 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" j7 F; @/ ?3 G# ~% i6 W% h; p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 o* V" y$ r1 _0 w0 G" v1 _9 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' a: m- i3 ^% O8 J+ O  d/ b
write('</div>')# k8 V6 k. P: E/ W" U* L4 n! _
}% |( Y; m; `8 T! g3 s" z9 D
else if (document.layers){
# U: c& k8 _8 D0 C. _8 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% H  z- a8 _' e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: v0 t- t: e9 r1 D' `write('</ilayer>')
' ~. H" b- C$ m}
; z5 X6 W+ k. e+ f; adocument.write('</td></table>')
; }" r7 n9 ?8 S& {- j( A}
& p' p# ?8 ^1 C# i4 U; D) Q5 @}
' h5 L" Y/ N9 t- `% M$ s</script>

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