返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 M! s! I  Y. B9 n8 F* zvar marqueewidth=300
) T5 N6 r; h( t, [& i4 k* O6 I( I//高度$ ^. q* K! [2 o* m
var marqueeheight=25
4 k" X% @* S" p% v5 C//速度(1-10)& F% P5 q5 {  ]
var marqueespeed=3) T* V. e# @) x2 \
//背景颜色
  K8 s; h+ G; b. h* wvar marqueebgcolor="#FFFFFF"& g) T+ x% O2 X6 p* [9 ]4 |
//是否能暂停 (0=no. 1=yes)?
6 ~, r  C4 e. O, t9 K; {' ~* Qvar pauseit=1
! H) s! J% J0 B! j3 Y
0 [. {' T2 ?4 D' ~; i//修改显示内容* N4 ~- J* v5 ?: [" |; w4 B/ C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ T! q3 D$ o: ]; W3 W  c0 `
8 a9 x: S- I) q7 Q+ K# k+ H1 L2 Q/ E1 t. R
////下面不需改变////////////7 u; b, U% s  C. A+ P6 ?' Q0 Q2 Y
6 H# S- b4 q  B$ b: r
var copyspeed=marqueespeed
' L3 Y  N% O8 a# Y  }var pausespeed=(pauseit==0)? copyspeed: 00 {; F; A. y( Y1 ]1 k
var iedom=document.all||document.getElementById
7 x( p: g' V5 s( |6 s6 C+ sif (iedom)! R0 C- b% Y; V9 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% d( V) {# v/ g. b; n" Rvar actualwidth=''
. p: H/ i+ Y3 t8 w5 W' ^var cross_marquee, ns_marquee
+ L2 y1 ~$ O7 S( m) h6 G5 K* M% ^4 @: N9 ]
function populate(){  W% P/ ~; ]* y2 Z
if (iedom){) ?1 W5 Z2 n: I: z1 d# t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: v2 Q1 i) A% y8 j: scross_marquee.style.left=marqueewidth+8) F; \9 D6 N9 m. l; M# p1 K' L
cross_marquee.innerHTML=marqueecontent2 y2 t0 l( d& w: x; [; p# r) p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, I: H% I0 u$ z}
! N9 K7 n, @$ {: I0 u6 belse if (document.layers){
1 E* O& e: W+ yns_marquee=document.ns_marquee.document.ns_marquee2
+ d  @& _$ O2 t5 c' \2 W6 zns_marquee.left=marqueewidth+82 f, \! t# }4 ?, r8 \" R- I5 x' x
ns_marquee.document.write(marqueecontent)
: V/ f( q# K: L& F" B1 K* N: \# M+ Sns_marquee.document.close(). T, e6 K- i" B' E
actualwidth=ns_marquee.document.width' }4 L( v7 V; U, b9 N0 g' `
}
  @% t( I1 g" ^: n- L7 |' B2 ~" Hlefttime=setInterval("scrollmarquee()",20)$ L# u! V$ W0 k9 r: D' v% j% H
}+ G; w; k1 x, H( M9 N' ~/ a
window.onload=populate7 [" C+ W: N/ k* B# A( I. g1 j

2 X! i, h  {2 Y- Z% I( vfunction scrollmarquee(){' H0 r/ P1 k: c, s. V+ S- R
if (iedom){
$ t! `5 \: {. U* F  ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* Y2 ^% o. D+ }' g5 Z3 r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( {# U" A6 y4 Z# I. x; Jelse
2 S1 a# ^! m. k3 a: I4 G  O) ?cross_marquee.style.left=marqueewidth+8# r6 H5 v( t$ ?6 Q. `
* m# [+ {7 r' k  u
}( f. d5 `1 _" K" d' y& A
else if (document.layers){
, p3 E# G( L  F/ ?) w8 y/ Iif (ns_marquee.left>(actualwidth*(-1)+8)): S6 \! f' W  R
ns_marquee.left-=copyspeed
- @6 p/ e& H% F6 _: p7 n/ X+ X. velse: V- _, U& i) `6 J' Y# K: n
ns_marquee.left=marqueewidth+8
) g9 @+ o8 P1 z# i}) C+ i4 y* }  e% k; Z3 H+ w# I
}
3 |+ b5 b* w3 U6 J8 K* i% d& V( b/ _+ Z3 \- X9 n+ f. n% d6 s
if (iedom||document.layers){2 K. D% s5 _$ S' F" |* t) |3 B
with (document){
2 f9 k8 @& J/ O2 Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ?% M+ @# V& z- F
if (iedom){' z5 M9 Z: A4 a4 w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, U; i- c, d- @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ `3 s" y& h) `3 Z; ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& n5 x/ h+ Z0 P- P' |
write('</div>')
2 G$ ?3 D) h+ x$ X}
# |6 ^5 G3 D! b/ G0 D! q. Jelse if (document.layers){
: ^8 F& y; O2 [/ O' Y! b6 @- p* y1 Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# F+ s3 X; v5 l2 A% N6 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 i3 h8 [: v$ T" f4 V4 @
write('</ilayer>')
0 i, T7 k$ C2 v. a1 a, X}7 s! t& \  Z+ a
document.write('</td></table>')
2 ]% ?& o) a* u3 A1 @}
! W5 Y. e& i! l}9 k0 l4 I1 p- x/ W6 {- J$ e
</script>

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