返回列表 发帖

网页之跑马灯文字特效

//修改宽度( |% a! m% }  |( ], y5 K1 E/ _( H
var marqueewidth=300
- s8 ]" C6 Z* z, V1 `//高度& H' [8 M) S4 J) X
var marqueeheight=25
+ r' S' F  ~) t( O% X  B/ m: C3 ^  J2 a  F//速度(1-10)2 n8 k( w( @5 I" b9 j
var marqueespeed=3
3 K* f' j* y: c//背景颜色# ]: n2 F! \! i6 g9 m+ {2 Y
var marqueebgcolor="#FFFFFF"4 ?* a0 }6 x  E# O$ c
//是否能暂停 (0=no. 1=yes)?' x' P! N9 k8 l& W1 X- Q. i
var pauseit=1. w7 E0 V  \, a
2 j! P. f; K- ^6 l
//修改显示内容
' E6 l) T/ N) d: G: p7 [; ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 {  T; i& ]6 P" K* }1 R
8 h, ?. y& a9 ^  S. w; e( r: [: k: z
9 ?8 `1 B3 n4 Q8 X( l
////下面不需改变////////////( ^& `3 \2 A' U5 d( H- W
5 H5 g! G* ?  ~% a: n& W0 L
var copyspeed=marqueespeed6 d2 E1 ~( _$ c$ A
var pausespeed=(pauseit==0)? copyspeed: 02 B8 U+ N9 n/ l( ]+ T
var iedom=document.all||document.getElementById4 Z+ T7 Q; A8 f  F* `+ Z  w
if (iedom)
5 F1 B' V( ]* l( Z8 f/ f9 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- w+ C2 f% o9 q$ X
var actualwidth=''
- C4 r( _# ?% Q' t6 d( F. jvar cross_marquee, ns_marquee
0 j$ b& g# j: Z3 Y; C. z
+ p% b3 S$ A  Dfunction populate(){
- a1 i# v( L3 r/ k1 Rif (iedom){
. j8 g, j* U5 h  q- Pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! |4 {% q: }8 z6 k. D1 p
cross_marquee.style.left=marqueewidth+81 h/ m4 |8 ^' e! J& e
cross_marquee.innerHTML=marqueecontent
9 \5 [. [" C/ R8 J% sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; |( i& W+ V. ^% }
}
) M" B6 P% l% i, B7 [else if (document.layers){) x+ ~/ c) F# k7 L; r3 P( p8 b
ns_marquee=document.ns_marquee.document.ns_marquee2
+ t. q2 G  u; lns_marquee.left=marqueewidth+8# n$ i; I; U% i2 C# d
ns_marquee.document.write(marqueecontent)
: [4 e( Y0 s/ ]ns_marquee.document.close(), y7 A* l4 z# j, ?$ p% s1 ?$ K& U
actualwidth=ns_marquee.document.width. z5 S' W. [; @7 p+ ]4 V
}
4 ]: a$ R$ p0 \* W, Y' c: `, Olefttime=setInterval("scrollmarquee()",20)* j# h! y! ]# I& `! ?; O1 Z
}1 g# n* m5 g/ l7 p% }6 [* u" Z' K3 `
window.onload=populate
( n! V9 i7 o: Y3 w
$ @1 B3 {5 Q: Ffunction scrollmarquee(){7 t( _$ _* L" g* H
if (iedom){
' R9 ~: I6 j4 n' \% c( nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" j0 _# i  g& V3 R. y, x3 w1 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 A% p9 z  Q  ]3 v. b0 zelse' W% F9 K/ @! {- @( N
cross_marquee.style.left=marqueewidth+8
0 ~2 s, @5 C  Q3 z! o' v2 q8 O; [7 S* U* g- |* o0 P( r
}/ {+ ~4 b' x2 E7 K$ U
else if (document.layers){
' p# F; |4 p3 I( i+ Yif (ns_marquee.left>(actualwidth*(-1)+8))
' v4 c0 B$ i9 x, i2 B4 n. z0 N/ w$ Uns_marquee.left-=copyspeed
$ c/ r$ V/ _1 N( I) N4 g3 Gelse
9 l) l* e( u, n/ k  f7 ins_marquee.left=marqueewidth+84 L7 m! X) j* Z, m3 F( h* [# K0 X
}* X. K* g% P% u' r+ c
}
9 `  |' b- ?( j' t9 y7 W
! A& R+ }+ Y3 `if (iedom||document.layers){
. q' L8 f) [8 U" b9 H$ ]( D5 S$ iwith (document){
+ g/ \$ |4 H& B8 R6 z* pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 m5 D7 j9 ~+ R7 O) t" E/ |" ~9 Zif (iedom){2 k* o  ~# m( Z8 F% J' i. d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- W! K! h9 J9 p9 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): ?: H1 m  C9 F7 n; H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! g! C) @1 W; \4 }0 S, @write('</div>')
2 n1 l  R" V3 ^. J& L9 x2 ~}
6 w+ @- k) E: y- Felse if (document.layers){
2 `2 H9 f, v" q, h: Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 {/ m4 X. X: L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); ^& c1 Z& {- C  e
write('</ilayer>')
0 Y8 {8 q# ?, w}* _' d. J, w8 }: [
document.write('</td></table>')
0 ^% l; {7 Y& Z2 m}
& ~9 O: |( K& T, b8 U7 f2 r}
; X$ \' e; u& T</script>

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