返回列表 发帖

网页之跑马灯文字特效

//修改宽度% s, X" a9 h* x4 X0 `4 @
var marqueewidth=300
# h) c: P- Z) G+ h% |//高度
: d! F3 }3 v7 R0 ~2 M5 ]var marqueeheight=255 q0 y# @: |& Z/ _9 O; r: \
//速度(1-10)
& P. R3 a0 ?0 l4 {. W1 u9 tvar marqueespeed=3
0 M( k5 p! ]) C4 W. M//背景颜色
& A# W' P5 _) |; }var marqueebgcolor="#FFFFFF"5 R% d" I! d& {! `
//是否能暂停 (0=no. 1=yes)?
  E) J7 e6 d- T7 F+ Ovar pauseit=1
# X4 x3 K$ x$ J* B4 e' a, ~. b2 b- d+ e, O0 F; n
//修改显示内容
; ~3 x$ X7 [' J( a$ bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: I& a1 p& {+ o. h1 A
' v) c/ D* c2 l2 n( q% ^4 s8 u8 W' k* l
////下面不需改变////////////# A: m2 I3 R' a2 p- L& R& m* k) V) t
$ v" C3 O( I+ g7 S- c! P
var copyspeed=marqueespeed
+ O2 t5 Z7 {9 |var pausespeed=(pauseit==0)? copyspeed: 0
  P! m( Y0 N) }, ], @) ]var iedom=document.all||document.getElementById
! G, j- W# d- b1 `1 k! @6 r  J" d- pif (iedom)) T) a' J4 @% L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 H( V( b7 L+ m( }, U
var actualwidth=''
. |) P. R% r. ]$ x2 ^, Uvar cross_marquee, ns_marquee5 f% s- w% }8 B+ p* A  ]( _
$ M3 h2 F- H2 @% Y1 h
function populate(){
; \/ N+ s" Y5 s$ i/ jif (iedom){
% B  I0 O7 j8 `: Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 Z* N. \% v* a8 ~$ A
cross_marquee.style.left=marqueewidth+8
  |  w  {9 K0 Jcross_marquee.innerHTML=marqueecontent
* z& _/ C- H+ Y3 d( g& Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; I7 ?4 g) m; s; Q+ z}' W5 y# H- M- f& O! }$ J) D) t: A
else if (document.layers){5 v: U4 h4 ?: X, k% i  D4 Y
ns_marquee=document.ns_marquee.document.ns_marquee2- f* X6 e# G9 Q5 d
ns_marquee.left=marqueewidth+84 u1 E: M) ^2 @+ F
ns_marquee.document.write(marqueecontent)+ C4 [9 z- m$ e, }- P
ns_marquee.document.close()* ]1 G2 G+ V; j. ]
actualwidth=ns_marquee.document.width2 ?9 t  U! d/ N( C
}  ~0 m0 l1 ]+ R) t# x8 g3 C( g$ _6 ^
lefttime=setInterval("scrollmarquee()",20)
& s+ v! n3 R& C( {4 Y* n' g}
  h2 @& [4 ~6 k+ z1 i9 D$ awindow.onload=populate, y) c8 i$ w" J+ Q9 J' ~

- S, s0 V% ?- z1 n( Lfunction scrollmarquee(){
- q3 a7 h5 X$ j# ^# {5 j. sif (iedom){
7 v# L" |1 p/ {' o  T4 {5 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 R( C7 |8 z) r2 @9 ^0 w1 Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% W: O4 f) k) Z8 @) P8 g
else
3 g1 j7 ^( L0 [9 ^7 c$ T6 icross_marquee.style.left=marqueewidth+8$ [- s$ @; o) {, @5 J7 u
$ |" H* D1 w. U" T7 V# B- ?0 a
}
! |7 }5 }: j) f8 j2 w; kelse if (document.layers){- z. N: U' G9 Y* x
if (ns_marquee.left>(actualwidth*(-1)+8))
" B8 F* d( r3 O' qns_marquee.left-=copyspeed( _: Y; h( _& s3 f& a
else
. v5 X; K9 P: i5 @! e. q6 X$ uns_marquee.left=marqueewidth+8
% Q$ r( y' t* Z2 A' O}
/ J  F) T3 g% }}9 N' h9 |- \0 y1 }$ K5 ?( l8 B

; q3 T1 Q" I8 _9 |1 w: qif (iedom||document.layers){
: R* O1 @( t, R6 v7 W8 g5 n  Ewith (document){0 W# ?' ]) M- k' F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 r7 k& W: P/ E& E
if (iedom){
5 f0 y0 s& b# y1 H4 Pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 x: ~" C* M) n! I* F) vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 O9 R4 _6 ?$ x; f: C, `9 T" L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: o+ @  ^% Y- g) T) Rwrite('</div>')" D0 n7 l: N$ Z4 r
}
( C9 r6 w0 {% h  W, ^else if (document.layers){& N# h4 S& ~4 e8 h' d6 D) a0 i
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- Q- M5 o8 Q9 s0 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ i+ X. h( ~1 m$ O/ n9 X
write('</ilayer>')
- I$ x$ T, t5 S5 C4 Z: U9 W}
% K2 ]# _; O3 {; Bdocument.write('</td></table>')
9 s8 p1 w9 c: G! b3 d}
6 r0 {8 M- U+ N4 q7 m* j% T}9 b) Q. f* a/ z, J/ [
</script>

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