返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 w; T& l# N4 z7 U) i/ j2 j9 {
var marqueewidth=300! R, U/ F' ]. i5 l3 m- |9 b
//高度
& M0 X9 l8 V" i; k* W: P) Ovar marqueeheight=25* \0 U  W$ C9 X
//速度(1-10)! t: M9 X! d$ Y& f  N
var marqueespeed=3
6 ^+ H+ l9 M7 r8 {  n' o- v$ }//背景颜色
# ?1 T; P* ?% ?) o, n" r5 y; pvar marqueebgcolor="#FFFFFF"  j9 p% N7 u$ u" d8 H& P
//是否能暂停 (0=no. 1=yes)?
3 X6 c7 X7 ]$ }  Q- @( Q$ B+ Dvar pauseit=18 ~% f4 [9 c* Y. L2 L
  w2 z/ d. k* g/ S+ c  f
//修改显示内容
7 W# {2 i. j( M6 ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 o( c* C- z" Q1 }) U6 P9 X
/ `0 O9 O5 i' X. G! @9 X' e) I! l+ r) Q& x9 h. Y
////下面不需改变////////////
" c( U* x* V. L0 r# `5 ^  [6 W6 W! A
var copyspeed=marqueespeed
% o1 }- }! J! A0 J# b5 X4 ^var pausespeed=(pauseit==0)? copyspeed: 0! M) j0 \8 M# C+ ~* G5 j* m
var iedom=document.all||document.getElementById
7 ?* d) u6 s/ O  c; Jif (iedom). _5 j+ s( `( g- Y4 S- ~: A) ?  I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  j5 a( X) R2 Q4 l9 ]2 k2 X
var actualwidth=''
$ V1 E' e4 j* [$ gvar cross_marquee, ns_marquee% Q% b6 R* `% b& e
, {- I; z6 n, M: J, ]4 g9 S  e/ p
function populate(){/ [$ v* P" h9 I
if (iedom){+ x6 B( x( Z/ n# j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 a9 f6 R* G# h% x+ Y
cross_marquee.style.left=marqueewidth+8
& \& I# v. \0 q& n  Ucross_marquee.innerHTML=marqueecontent
2 g- Y- }& [3 D; C- ~# X9 Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- r5 U1 h; r4 Y  Z8 ^8 R# ^}
$ ~' `5 B  M0 Y* Zelse if (document.layers){
/ \7 ]$ q/ W. f/ ~# uns_marquee=document.ns_marquee.document.ns_marquee26 i0 x  m; f. ~
ns_marquee.left=marqueewidth+8
+ \7 a0 j8 W' i& U% @6 R4 W; kns_marquee.document.write(marqueecontent)
1 }' B; a+ g% K6 R" fns_marquee.document.close()
% ?6 Y' ^7 a: jactualwidth=ns_marquee.document.width
3 @: y9 d* T+ n2 x}2 i' y0 Y. G: y! W; X
lefttime=setInterval("scrollmarquee()",20)
. H& w- R& p5 _9 i! T1 L}0 B7 D% S3 u: q6 w% u& s
window.onload=populate
. b* H- m4 p( T5 U9 C9 y9 e- x+ h4 V( f! B
function scrollmarquee(){
" J) \' j# g+ N+ q& eif (iedom){
0 |% k/ f. L) z" Q* w$ T- J& {) dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) u4 m, r- P- H( z4 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: R; Q- J, J  L& h# b5 {
else
, I: T) ?1 l" ~# i: ycross_marquee.style.left=marqueewidth+8! \% x5 ]( p7 w0 m* y
: ^& Z4 I4 e. ?
}
5 r  C5 J% M/ x9 v" Welse if (document.layers){8 x) c& i  R& \; k$ N
if (ns_marquee.left>(actualwidth*(-1)+8))
' [/ W/ C+ G' N: f0 ins_marquee.left-=copyspeed9 I* I& k) C$ B* y6 W0 @# Q
else. P( n. @8 p/ I% A; x5 ~" ^
ns_marquee.left=marqueewidth+8
% N' P. E; Y  ^8 _" H2 H}
6 ^9 |1 L. H! ?6 u" k+ |5 d}
/ D- o) _  w* @$ g* I2 R5 G# s$ M$ @- o
if (iedom||document.layers){
4 H" U) X, o' {8 P- ]; mwith (document){1 k) m4 v* h  l; U+ ~+ i" {: J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 q; n5 V7 j& x6 c! [5 P( T
if (iedom){( B$ f+ D: x! h4 S8 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) U* h; U) P  M% b  [# ^7 n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. C* u' B% `2 v. t2 j  Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 b# Q. K9 }& ?0 @. b
write('</div>')
. I" @* H% w2 \0 T- F" Y}
. a- s8 }. ~" lelse if (document.layers){9 f/ U2 F& D6 I3 F: ?& z+ Q$ _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). k' z: b( ^$ Z% p8 L+ P  M2 `
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); ^5 h( E9 z" w8 |% O
write('</ilayer>')
1 Q- r& u3 t% j: @; {, `}
2 E0 [/ ]* z$ l  r! fdocument.write('</td></table>')
: v; Y+ K# a6 w6 e- u- Z) ^+ N& \+ \}5 p0 H: X$ M) S2 y: ?" X  x9 e
}
2 |! t. r1 b  x- k' v* X</script>

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