返回列表 发帖

网页之跑马灯文字特效

//修改宽度- j* v0 K4 h( ~/ w9 x
var marqueewidth=3006 U2 M3 R+ Y) Z' ]& f
//高度
0 Z+ A' i4 ]  q' `var marqueeheight=25
" G) |2 P/ ~( E: G//速度(1-10)9 `! K5 ]6 C# F. z- n& A2 W
var marqueespeed=3. A9 W8 d4 }; k8 F( i
//背景颜色/ Z7 d8 g+ Z$ h/ M# V. [+ w' I, a
var marqueebgcolor="#FFFFFF"
9 l6 x4 [6 p/ Q( q//是否能暂停 (0=no. 1=yes)?
% B6 h. J5 F& v3 b" l" t+ Gvar pauseit=1
7 j# _& f- N9 s7 c" |0 @, n
% K9 m) C# i* \1 r/ l//修改显示内容+ i6 J5 j; g, @7 v1 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 c' |( c9 L4 ~, w$ C0 C+ d
+ [  A8 m: h9 G+ R% ~2 Y* I
5 J8 S+ C: @, P, b" N////下面不需改变////////////
  T# X' C$ r0 n4 o: m. ^2 V. {& [  C! D8 M; a, V6 E! _
var copyspeed=marqueespeed) U7 b. y( L) x6 B
var pausespeed=(pauseit==0)? copyspeed: 0- t& Q. R! x- u- Y7 P. _1 I
var iedom=document.all||document.getElementById( l, `) Y5 t2 b4 g2 M- `% [
if (iedom)
! U. @2 k3 z% C8 g2 S, k3 }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& L# @6 b; \8 r  U  a7 d: Jvar actualwidth=''5 T8 \& C" L* j
var cross_marquee, ns_marquee
% [5 {0 q0 m" H# z; @. u( z) |, A# W5 i5 X* A0 v$ N
function populate(){
0 t1 F& V' ^5 \) m! `0 O2 Tif (iedom){
0 ^% y& A% D3 Y! scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 E' t$ t! h) ^( i, B
cross_marquee.style.left=marqueewidth+8' B, T7 B! R! k. s/ I. Z5 ]
cross_marquee.innerHTML=marqueecontent
* Z5 o/ n. I9 g; b- G9 C0 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 o! b: F8 k: h; b}
2 X0 @/ v! ^: M& H3 Jelse if (document.layers){  L5 w, x! v% j  ?
ns_marquee=document.ns_marquee.document.ns_marquee2
2 @- p8 T1 ^# K7 c2 ]& o" Y/ {ns_marquee.left=marqueewidth+8
7 I; B- h3 z3 V! Q% ~" w$ l, Z" B6 {ns_marquee.document.write(marqueecontent)
, A8 e9 g9 j5 l2 G4 j  @! Tns_marquee.document.close()6 Y& ~1 w1 r* d0 G2 x- ^+ }
actualwidth=ns_marquee.document.width* v  q  t& ~! b, N8 T
}4 F" Y+ Q& X- C
lefttime=setInterval("scrollmarquee()",20)( [- x3 Q/ X" R8 ]4 q9 W7 ~
}+ m2 l4 K0 j1 f
window.onload=populate5 i( p1 N7 o# x4 ~4 E* S4 [" `
4 Y' h( N& N* k8 d1 c
function scrollmarquee(){, G( n' ~* r- S" x3 I' x) Z/ r
if (iedom){+ a# }" Z, i4 m  c/ ^! x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: i1 F0 e( v. across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( g* F( S8 v$ X  ?/ N, g0 helse
; a- L; w4 |& h; y. \) Fcross_marquee.style.left=marqueewidth+8
: H% s/ z8 A6 R; e5 M! _5 q  S5 Z- o: I0 R, D+ l
}
2 G- j) }# U& n4 C0 lelse if (document.layers){
* g& E3 \: l* g1 q4 Oif (ns_marquee.left>(actualwidth*(-1)+8))# X% a, s1 d$ a
ns_marquee.left-=copyspeed1 }/ U8 _! u! n( ^' M  M" j9 z
else
! x" a4 Y# Y8 J8 \; m$ kns_marquee.left=marqueewidth+8
- i; H8 S+ p5 ]}
+ o) E! c1 N% N6 e}; E" J7 x9 t; O! f+ D# [

0 N2 Y5 g/ B1 q: U8 O4 j) l# ]if (iedom||document.layers){' j1 w3 \% g- s9 O+ Z! K, ^% T. p
with (document){
& n9 Q' O; k3 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 c+ p/ \+ a8 eif (iedom){
$ K$ }/ y3 b& Z( z- twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 M5 J. \' {9 t4 X9 v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). }  P4 G$ \$ A( u1 ~4 o  M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 }+ Y8 p) {, \+ N
write('</div>'): p  _$ i6 a# n. f$ K/ M$ f0 u" K8 D+ S
}
* G0 R1 h5 a. F( N: L+ Jelse if (document.layers){
8 ?! p- u& ^7 V, Z/ w( \, P+ ?, ], g* ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ K( E2 l- g3 s; q- R8 R9 _  h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 H2 k6 E) ^/ F# G; cwrite('</ilayer>')
, l4 b+ h+ {; |! U; \( S}
. P$ i( ]: F' H  ^document.write('</td></table>')
$ U; t0 D, m6 }}8 L  U, H3 O! f4 b8 k
}/ O- D; a( I  U, |& E' u
</script>

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