返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ G. g0 a1 J' ovar marqueewidth=3002 ~0 D7 c" m3 U7 Q' r; s8 m6 k
//高度% V# U# ~+ w' ]2 @
var marqueeheight=25
, M) \( d. \% r//速度(1-10)2 w0 a4 p) L3 n* a2 D( z
var marqueespeed=31 V+ Z" N5 u* B( }# \7 N" Z
//背景颜色
- B* @1 K- Y9 A: kvar marqueebgcolor="#FFFFFF") u$ m' a& o7 x) E' Z" R
//是否能暂停 (0=no. 1=yes)?
& w( c  U2 F7 k: i6 b9 pvar pauseit=1% H7 u# Y% y2 g3 F. ~, u

3 _0 e1 i6 {, _% \! B$ g, ]//修改显示内容& L& x0 l# m$ m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: ?5 y1 g2 Q0 y; E- {2 n
8 [0 k# d$ N0 N
9 a7 A* y# x( R5 z2 Z: Y+ Y" y////下面不需改变////////////
6 y- J4 J! P8 H' H
* H. \( c( j* }4 i- r6 a: c( Pvar copyspeed=marqueespeed% G5 U# L1 R( L3 a- q! K9 y# v
var pausespeed=(pauseit==0)? copyspeed: 0
* X$ [4 r& B, e1 y' g. y. P5 m' Xvar iedom=document.all||document.getElementById
/ f8 W! r% L" xif (iedom)
. A) b3 X& q& D( `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ M3 `, ^# N6 P' L, ~
var actualwidth=''' j( N1 f6 e- g% r, _
var cross_marquee, ns_marquee
4 R" @2 G3 `1 j1 f3 c
) l; N6 L# `  K5 @4 Y' K) o" Ofunction populate(){  I: P  c" W7 \9 F
if (iedom){
- r5 ]* G  t6 o" O7 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) I* W' f3 F7 w( C8 n5 P8 ~9 G1 e
cross_marquee.style.left=marqueewidth+87 @$ Q# `" q  I+ g
cross_marquee.innerHTML=marqueecontent5 b0 `/ d( c, e) X7 }: s) I* G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 i; \. c% H) H/ _0 r}
8 _1 J' \6 l8 _* Z1 Q  e5 belse if (document.layers){
- x2 @( |! I% c6 s: W0 kns_marquee=document.ns_marquee.document.ns_marquee2( z9 c8 x6 _& g% T& {
ns_marquee.left=marqueewidth+8
% o3 G! Y0 z  mns_marquee.document.write(marqueecontent)
1 o4 @+ a) r! @4 Y6 Dns_marquee.document.close()
6 X+ e3 [3 k' n* h# jactualwidth=ns_marquee.document.width$ y5 o: a! p6 f/ ?' E7 S( @) y: _
}
4 O( u  O) O- [: M. M7 {/ |% Q( @lefttime=setInterval("scrollmarquee()",20)& B6 i+ y: `9 Y2 J8 r
}6 u* ?( s# E' v$ J" Q  }
window.onload=populate
8 D2 Y0 D3 w% O. T4 o5 O% [' U0 d" x' o
function scrollmarquee(){0 B% }+ V$ y, u5 z- b1 K
if (iedom){
3 f: S: {# s; }6 C0 [if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" S' a: z3 J5 Z8 D; J) Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& X3 n# H) d; w( B5 a- _
else
7 r7 m4 W  |. X* P6 A2 ecross_marquee.style.left=marqueewidth+8
  m6 ], a) z( x  W5 t  f
; V# A6 |' z7 a  A}
/ o& Z" `$ K& aelse if (document.layers){
5 S% w% B: b( l9 oif (ns_marquee.left>(actualwidth*(-1)+8))
: X4 a( e$ ~: p0 \* h5 ?ns_marquee.left-=copyspeed
0 \- p6 s& Y+ c: p2 x( ~) eelse& E. G" o( b" X7 ~
ns_marquee.left=marqueewidth+8. i  h# c$ a2 N  b$ `
}2 H2 p+ ?; e7 y+ Y7 E' W. d. k3 B
}: d# [& j8 G. [3 H
+ X2 N) i% p, _- E/ s" C  @
if (iedom||document.layers){+ M5 \- N+ Z# g" X" @
with (document){
* {3 Z$ K) F5 `2 `  ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), A. \& y4 ~$ r3 E+ q, L/ ]
if (iedom){$ |5 V) g& t+ H% v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' p2 X, H2 h6 s- [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 q5 a4 ~6 k' X6 f7 V- G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). |) ]: u; M; I. R& L
write('</div>')
' |6 ?' j7 p( U4 i9 v}
! b8 }/ Q- e1 T3 L( w4 helse if (document.layers){# y( ^" z% `% A& S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 `; A* J5 ?8 b$ V; @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  _9 X1 @  K9 g3 J, L/ `
write('</ilayer>')! z, C" J: x/ i) D
}
* R* o+ \. X& }" I$ y& D) Adocument.write('</td></table>')  \; H/ w' d5 Y3 c7 H
}) W) J1 e+ t* a! }9 T. I" w3 D
}7 \9 L5 j8 O+ `; m
</script>

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