返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; Y: [( O. X7 N7 Q  B! C. cvar marqueewidth=300
/ T. |9 S' O, h$ c1 P' Z+ ^//高度
" a, q! m; Q( F0 p1 U, [. e- i) avar marqueeheight=25
8 ^% t3 s5 e5 Y" U//速度(1-10): U( V/ p' ^8 X; I  P& i- {
var marqueespeed=3
+ q; x: q8 ]3 Z5 D+ S1 K//背景颜色
+ E* p9 H* f- s; R) p+ }6 G8 vvar marqueebgcolor="#FFFFFF"# m5 F% g% D! ~1 {) |
//是否能暂停 (0=no. 1=yes)?
* A2 K2 q, T+ |: Z& tvar pauseit=1( Y1 U  e5 E5 Z! ^# v+ ~+ b" q; g
1 l' o2 [' e9 l' z+ T, T/ ^- a
//修改显示内容
- ~+ {6 n. a1 q5 v3 p3 s8 K. r6 dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, b# B& q+ K  p! u
1 [! _7 h  e6 M7 X# ?- J0 R( |, x
////下面不需改变////////////
% R7 c0 u/ w, d' z0 H0 y1 X; a
$ f: g9 j  b6 o6 D4 Q2 [. x% s( Zvar copyspeed=marqueespeed
. R8 o9 j" R1 J4 I2 Rvar pausespeed=(pauseit==0)? copyspeed: 0; z2 ^. K4 ^) `: h2 s9 t
var iedom=document.all||document.getElementById4 f- P2 r' q: c% W9 _2 o- s3 H& L
if (iedom)
: t) r) `' t- `1 U5 edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ }  z8 q3 C* B+ Y; i: f
var actualwidth=''8 X. B  T# }& p: H! }& S
var cross_marquee, ns_marquee
; |$ N/ o4 c/ K0 H, y' L7 P6 _. ~: U2 o* r. A$ d) Z4 T4 l- ^% c
function populate(){9 O" O# U% C$ a
if (iedom){
. Q# R6 c* v% g; L. {- ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 [0 H% V( ~9 J0 |7 _8 Across_marquee.style.left=marqueewidth+8
! _! K9 i9 T7 o5 fcross_marquee.innerHTML=marqueecontent, Z. O8 q1 n5 N7 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# y+ [, e1 S! z" w& s* R  u}9 ~9 J- z4 @8 t0 g
else if (document.layers){
$ X! l3 w! g" i6 N' \& ~ns_marquee=document.ns_marquee.document.ns_marquee2
0 J6 G- t# O+ e$ H4 D% j# @9 Pns_marquee.left=marqueewidth+8! f/ Z0 `1 q2 Y  u6 b
ns_marquee.document.write(marqueecontent). H, s: c9 R$ f/ _* t0 ]; L
ns_marquee.document.close()
  ]6 L! k) A# ~  Aactualwidth=ns_marquee.document.width4 \( p0 j& X9 c  p& s5 ~. g
}
0 S! f& p8 H4 {. g1 [+ ]+ Vlefttime=setInterval("scrollmarquee()",20)
3 o* `4 x  Z# ]5 z) F}7 A4 z9 V7 H7 Y
window.onload=populate- s& K9 Y* M1 t4 Y1 l6 K+ W

  Q, _1 s: @% i6 a% Xfunction scrollmarquee(){, h5 K5 @4 q  \. j) r( e
if (iedom){% h3 i6 k0 S/ h) L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- N" M7 Q  Z: m* {& e0 Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ O/ W# a5 d6 u3 J4 D- x+ p  celse
: j' l, _/ P, Z/ b. E* M5 Zcross_marquee.style.left=marqueewidth+8% e0 P) A. H3 i7 G3 l

. J) i2 h# _9 Z) n+ }}" ~8 L1 v) }5 T; N6 c# n
else if (document.layers){
, O8 n- \* D' E3 S. Wif (ns_marquee.left>(actualwidth*(-1)+8))
1 U7 I: d) E5 j" p. z" u7 a9 Yns_marquee.left-=copyspeed
; H- q! _4 R( Q1 Aelse' c+ t2 Q  U* A5 Z' D) S6 T) ]# h
ns_marquee.left=marqueewidth+8
& _! R- L: y, [! x/ V}
0 z, g1 s0 p3 @& i& V2 Y}: {  |$ {9 t1 e& Y, _1 C$ k* z

; i2 f2 e+ I4 x' Q7 k+ Y1 Lif (iedom||document.layers){: `( r# t. a" F2 {: \* R
with (document){
# e* E% V; t% E, d$ Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 U+ L+ G+ W) j
if (iedom){
) W! }% G" M- g# S4 \; ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 ^) r9 o/ Q0 g0 ^3 d( R' wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! n  g& e" K, r7 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ Y6 V3 p0 b- P! B, |
write('</div>')
: D& @, `8 F8 {. P; n6 u! j& f}; Y: e+ P& V1 d* D8 W$ J
else if (document.layers){/ J. f. I1 d+ h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. U1 p1 b0 _* l( |8 `4 O( q: T1 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 K) F$ M3 p! X6 cwrite('</ilayer>')
0 Y& W6 ~" e$ N1 \+ n4 @( [}
+ r) J6 F( Q$ T0 ~document.write('</td></table>')
7 G" U) z) }# L% E" G}
7 ~* \! O- n2 |* f, H) n1 J3 P}; {7 P3 l. E/ B; `$ Y! T
</script>

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