返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& `  h( m$ p0 L7 _2 |var marqueewidth=300
4 l- i9 r3 }1 z  Y//高度1 x: y- T/ ], Z# Y- j4 m
var marqueeheight=25' b% g# C' S/ \; a8 Y1 p; S
//速度(1-10)( [2 D0 l3 l$ H. K
var marqueespeed=3
' B4 L7 X; t9 s6 b$ q3 L//背景颜色
* k0 F3 R& s5 O" m" I2 Nvar marqueebgcolor="#FFFFFF"' @$ C; m5 ~- ]7 W  b* ]
//是否能暂停 (0=no. 1=yes)?6 g7 g+ k, t1 Q/ P- r8 j  u0 y) z8 T4 a
var pauseit=1- P" h# O# R/ m2 p( ]9 x4 N: Q

7 _8 x5 F. R: d0 B4 Y; [" X//修改显示内容/ Q( `, `3 Q3 r  F! V: B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 Z) ~" r! f- v, i6 |0 L0 {# |: q- F1 ~: X# M) G
& B7 l- a6 w, O2 `5 t2 [5 }7 n  Z
////下面不需改变////////////
; }/ D6 e9 W3 r8 ]) S: m9 T4 S% R( U8 N2 K* i( [
var copyspeed=marqueespeed2 a  y9 M  J, q+ X, s/ Y) e
var pausespeed=(pauseit==0)? copyspeed: 0
) q( P0 p' s# p( {- ovar iedom=document.all||document.getElementById
0 u0 H7 k$ i8 K# i  Q5 h  bif (iedom)
8 U3 ~3 }, u1 x. c. o# o# X/ Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& o# |, h" S1 c
var actualwidth=''
# r" D* O$ Z% |var cross_marquee, ns_marquee9 U  r8 x2 g- V" Y

& U# O$ A; O! O3 ]7 s" K3 Efunction populate(){
3 q) f) k3 X( |$ @/ l7 Eif (iedom){
7 j, A8 B: ~) [9 gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! [: v1 y$ x2 J) ?6 c4 v# Qcross_marquee.style.left=marqueewidth+8( w! A$ @) e2 I& a" t4 N, Q/ p, k
cross_marquee.innerHTML=marqueecontent1 Y% y4 o5 R, i2 L$ b! X3 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 M& V% V. K9 U* C" G& k}) r( d+ ?8 T; n" b( V
else if (document.layers){0 d2 D, P& k1 l5 d3 T+ Y$ S
ns_marquee=document.ns_marquee.document.ns_marquee2/ x/ V* k4 T3 Q/ ~
ns_marquee.left=marqueewidth+8
1 m" @, m, E/ U3 U8 yns_marquee.document.write(marqueecontent)
0 i2 P/ e2 j. i1 y* e+ n5 pns_marquee.document.close()
7 d3 S3 r% F/ W7 r# v9 oactualwidth=ns_marquee.document.width5 O+ g7 d7 w2 `) y5 c
}6 ^: w2 S* _2 _6 O0 o9 T
lefttime=setInterval("scrollmarquee()",20)+ a. }& h( r' s  [7 X
}- d! L1 V1 c2 d4 I
window.onload=populate5 E5 j4 T1 i3 ^. V1 [) |; z' y
1 N3 r4 ~' G" J1 o: u
function scrollmarquee(){
# k# t6 D+ H+ O, b0 }! q6 S) v* lif (iedom){8 O2 ]9 D/ z& X- @2 c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): [: A7 |+ y( z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ c; g# d2 W  i! W9 j8 melse
4 F# y' [  L. }0 b$ }cross_marquee.style.left=marqueewidth+8
! y  s% h5 l- R+ c$ l( y; v$ Z  s% Q$ q9 [
}' @# a0 ~. B/ ?- |. S  ~" n
else if (document.layers){' O. Z7 C; X+ [/ o: J: y$ E  A
if (ns_marquee.left>(actualwidth*(-1)+8))7 y7 l' L6 d6 l, O! G0 f2 C4 I; Y
ns_marquee.left-=copyspeed3 i$ i8 l2 T: Z8 B- J6 @5 N% I2 b
else  w/ X* I' G4 Z( X7 V
ns_marquee.left=marqueewidth+8
9 z6 ?, ^2 J/ O5 E5 _3 n6 T}0 e. J7 W: q0 g8 v) V
}/ f* V! V2 g$ s* A. P

( h! A: H' ]) x  e; L1 @5 dif (iedom||document.layers){5 J) ~5 @( \$ W2 ~
with (document){+ E7 i2 k0 g! P% ?- X. T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* F0 m. ]1 o! `' C4 W% d9 y
if (iedom){- [: y/ S! q1 Q- V/ d5 c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 S$ u/ Z% w. t& ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( r% w8 U! f+ v8 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): G) S2 }: g' K
write('</div>')) Z% P5 ]0 S3 i# F* Y3 q' b
}
4 y' o, f2 d' {  f0 ~& P) Eelse if (document.layers){  y+ |' U4 j2 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  @- Y% e, c" J- h' g1 B0 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 v) k: z3 c' H6 C9 [; T6 i
write('</ilayer>')& D% s  ?5 M8 `/ V. o* ]" P
}/ x# |" C/ A4 G1 Y; S, m
document.write('</td></table>')
1 q7 A; E3 r: X: A+ {- ~& z( B5 J}: W+ T: U8 Z% m6 _1 @( {3 w) H# H
}; h4 m5 b. v& G& x$ [
</script>

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