返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ F. j' G2 Z- f' Jvar marqueewidth=300& C9 k$ x) k. i$ i: B/ \
//高度3 ]. W# U' A4 ]8 [9 i: L* W
var marqueeheight=25
$ r& B3 }* C6 ], a+ y//速度(1-10)4 u0 k: K$ s" D* ?  D) h
var marqueespeed=3/ B9 ]1 p* F  ]( \3 o3 c+ C6 `
//背景颜色3 y+ x$ Z1 z8 O# q& N
var marqueebgcolor="#FFFFFF"
' \7 ^/ ^0 n2 }( x//是否能暂停 (0=no. 1=yes)?
; A' ^: |# W4 f: C4 R# ]var pauseit=1
/ J7 k/ E; e1 F) U% z. l3 X0 }7 c) f+ B0 y2 ]" z8 x) x: Q5 S
//修改显示内容3 F6 U2 k9 _0 G9 P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. p. s% r- J+ a2 W" g/ c! I
# t- r, u" a! [* b) R( X# O  P) H7 N+ a. P
////下面不需改变////////////
- Z  ?) d6 h* v& ?( ?: }  P$ |# n% G( ~" G/ J
var copyspeed=marqueespeed
0 |: @- f. \  u6 f  _var pausespeed=(pauseit==0)? copyspeed: 0* d' O6 C9 l/ \, U
var iedom=document.all||document.getElementById, r4 q, y( j: [, C* ^. S6 K* h
if (iedom)* g% ~" C" Y2 t* F- R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) n5 G* B# \( _% ^' K" bvar actualwidth=''
' o$ e0 J7 g0 [8 Q2 \4 |  s1 avar cross_marquee, ns_marquee; p( K+ a5 Q" T& y2 ~

  J5 R0 B# A' ~8 o& Yfunction populate(){
4 b: O/ [4 i# B- V6 Nif (iedom){5 g) Z4 I" x2 @* R2 U& Q# ?. z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- h! X- \9 x6 u5 L5 l5 G* d
cross_marquee.style.left=marqueewidth+8
3 Q2 k5 m2 H4 h& l7 o6 ecross_marquee.innerHTML=marqueecontent, N# q- {7 I. f& a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 @5 x3 @" f, Y" }
}  i$ R7 @  }/ f9 q; e& c
else if (document.layers){
8 X' {( W7 @9 |ns_marquee=document.ns_marquee.document.ns_marquee20 `" c9 _4 f6 J$ q. L! I. L
ns_marquee.left=marqueewidth+8
$ a# K: i1 x. G( b3 z9 e( ]2 q+ O$ Pns_marquee.document.write(marqueecontent)8 g: [. _7 c4 `( w6 {" }; v6 {# r
ns_marquee.document.close()
/ g8 y% r- o3 I2 {$ o3 q5 Factualwidth=ns_marquee.document.width
) j' z' T  F+ X3 i2 V3 v% s}
7 M+ w( |1 c1 }8 T6 _9 ]lefttime=setInterval("scrollmarquee()",20)) k% }, e4 H  U8 g
}
+ Y8 ]1 s# w' G8 n! J; e& kwindow.onload=populate
5 a2 }3 ]* z1 X% A" }- S; ~) V% C, r' ?3 h$ X
function scrollmarquee(){1 N* ~2 j; e) N) G* l  [
if (iedom){: \  N9 w+ A% Y1 \" m+ I) x' d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# Z( f, B6 p2 g, C8 R* xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 s1 \2 i4 ?) h  D$ F$ `; helse. m  O+ P& g" {- Y
cross_marquee.style.left=marqueewidth+8
; E/ B' S. h& g( l" p( e( `$ Y2 M3 X8 E& T1 Q1 ?5 n, K
}
  i" J/ T& K% p* i( xelse if (document.layers){7 Q2 A1 P) x# X' f
if (ns_marquee.left>(actualwidth*(-1)+8))
* S5 p9 y0 k! I7 Kns_marquee.left-=copyspeed
' m2 h* z- a4 n  selse2 y# j! e1 f9 S, L6 O7 j
ns_marquee.left=marqueewidth+8
' W( l8 F, r  U  X/ ~3 F}" u" D6 g5 H2 f8 N4 Y
}" ~$ y8 `4 D+ P6 U; B

4 `7 O) {6 z% j  D0 f7 zif (iedom||document.layers){
' @3 y' Y7 z* y7 _, y' kwith (document){
/ ~0 N. C0 J& _7 \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" ]5 t! e% s& W# _2 _4 M( e- ^
if (iedom){
& |9 @- }+ S( i  o5 r0 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 v/ L- R' e0 `6 R* d" s. b: ~; C. t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" I/ X' h6 O/ U+ Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# F& l& B6 N# H+ z7 c* P( _write('</div>')5 D& P" Y8 Z/ Y7 w1 \) F" @% x1 |2 K
}
  U# E/ ?3 `: i! |  q4 relse if (document.layers){
5 G  f" {2 g7 Y: uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- x7 T5 t; A4 {) N1 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. v4 q, |8 j/ M* R1 ]  c3 Qwrite('</ilayer>')  t, u( f" z( `' M  v
}
1 l1 H" |6 H5 [2 [. Wdocument.write('</td></table>')
7 g# I  h2 @$ @( H}4 W% g: h1 |, {2 S4 x5 g1 k
}$ z0 B) `5 p. K
</script>

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