返回列表 发帖

网页之跑马灯文字特效

//修改宽度& f( c. W0 c3 J$ E6 s
var marqueewidth=300, e- d9 e  _* r/ L2 x! K8 y
//高度  l% V8 Q5 p8 `  I& g5 B, d( l
var marqueeheight=25
& i2 y' X* O* Y% b/ h# V  j5 m//速度(1-10)0 ]9 r" G5 }0 J# Y0 L7 Y
var marqueespeed=3
% m5 K; o1 g+ ]0 j# W; s5 C//背景颜色
: R' U( x# W8 Lvar marqueebgcolor="#FFFFFF"
/ H3 C5 p' o/ ?7 R+ F% Y( f//是否能暂停 (0=no. 1=yes)?# S, ]! ?5 I9 a& o8 @! R$ A
var pauseit=1
& S) W! Q, _% ?2 U* g
: g+ d1 N/ J+ _/ e" x//修改显示内容
; _2 M7 u' Y7 H. ^/ `: ]& X1 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# S6 P" u0 `2 L# I& k* {
* y0 H' \' F: `9 `, B3 z+ c; q: d) x8 X1 @
////下面不需改变////////////, u- Z- q* a/ u8 v

9 r) `' ?0 o8 ?  ?* pvar copyspeed=marqueespeed
' c9 j# D3 E# I& R/ g/ dvar pausespeed=(pauseit==0)? copyspeed: 0
  |  n! g. O# n6 l0 ?0 U) n9 X( vvar iedom=document.all||document.getElementById( S  n4 B5 f/ b* w& k. c& ^3 M
if (iedom)! q# ]  k. j& R) ^' {# f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* w0 M* i% D9 F; @9 z: a% uvar actualwidth='': G: j) U* i) G/ _
var cross_marquee, ns_marquee
. u+ R8 A( R$ F. F# ^' M& L0 S! c: w0 }7 L) X
function populate(){
; O7 `) }# \/ K& i6 S0 Uif (iedom){( X$ N6 u7 M' Z4 Q7 l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 K* }2 z. s' h) h0 {/ {
cross_marquee.style.left=marqueewidth+8
: o: ?; }0 W, J  V8 c6 {, o: ~1 Tcross_marquee.innerHTML=marqueecontent1 |: X. U0 z7 A% \, n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# z/ c9 W' \; R, A; \. p9 M  u! K}' z; c) K$ g+ y, N
else if (document.layers){
* K1 b$ R+ ~2 L3 g* ~) `ns_marquee=document.ns_marquee.document.ns_marquee2
. C/ W3 P6 f/ W8 O6 |$ l$ w4 sns_marquee.left=marqueewidth+8
7 |0 D8 d1 \! p% S: d  W) k7 L- z9 E, Uns_marquee.document.write(marqueecontent)) |% L9 u6 \! X
ns_marquee.document.close()) `5 S, \' T$ S) O9 y  {
actualwidth=ns_marquee.document.width
, F$ s; S  T/ L0 n0 D! I7 w}5 T5 _6 D, j$ c7 m. `3 C
lefttime=setInterval("scrollmarquee()",20); c9 r$ w. N9 |: W( k  G7 F7 a& S
}
2 \; A- L0 p2 Q' D4 ewindow.onload=populate7 O5 c+ \" K$ T& k, O
$ V" T% [% E/ X1 U2 K& V  R: s. [
function scrollmarquee(){! H8 G$ J, w8 {+ t
if (iedom){: e0 t* ?4 I4 G# i% Y: I( d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 M4 t* _5 d, U( {7 Q- pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) [7 o3 H9 T5 N  R- V0 Z- u+ L
else7 ^7 L! j" r' B( V
cross_marquee.style.left=marqueewidth+83 Q! C5 h1 m- ~- k2 L

( E- |4 M+ `- ^- W$ \}% C) k# u# d1 p5 Z* d: {) L) `$ x8 A
else if (document.layers){' b. K% N5 j8 v& x+ v8 v
if (ns_marquee.left>(actualwidth*(-1)+8))
" i# \6 t! e" L& Q- pns_marquee.left-=copyspeed4 F! g2 \# _* z5 r  o
else5 m6 e/ V' \, s: k
ns_marquee.left=marqueewidth+8! o  _$ F( ~7 U. b; u
}
( f7 Z/ i: ?* D* U! E; {) T; G! F}; N1 A: h+ ^1 Z
/ d2 \* S& p& {0 T# V6 N# n$ k8 R
if (iedom||document.layers){( D5 L. ?7 \- ~* X3 Q
with (document){2 s1 t. i) u0 t# O( x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 }3 Q7 z7 T9 m! q: ~$ Sif (iedom){& M5 T6 ?" r) F7 `: Q2 O/ X4 X& R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# O  g1 n9 E* X" A2 qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ u4 X& D, }5 I0 F  D4 L: g. S* \6 iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% A. W8 ~6 t, v& B7 ]write('</div>')9 |: i3 M9 D4 p* C* J# O) g
}
; t3 z6 L9 U9 [6 R3 n; zelse if (document.layers){
$ c, f/ e, V5 q, m9 E6 ]' }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' l6 ?: c, z; F+ E3 `0 O, Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 F! @; e9 M/ b
write('</ilayer>')6 q" ]( y; R' [( w+ v
}
+ V1 N& X% n$ Kdocument.write('</td></table>'). f( |) m+ Y- \$ u7 z' t- i" f& k: {
}
# X9 C' z! v# B$ h' O2 i. X}
( P7 M4 l1 |8 I9 l" ~& ?</script>

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