返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( |' [; W* r* l3 Q& e& A7 nvar marqueewidth=300
5 B* m, t4 }' g8 ]/ h//高度/ e5 m7 K  \, B2 r7 _
var marqueeheight=252 L! L. @9 K5 y" E3 \* p) S/ B
//速度(1-10)
+ u( [3 A  S* {var marqueespeed=3, `- |. {0 H5 w+ b5 c' p/ W+ x
//背景颜色- Q( G, h" p& W: R, V: {& q$ m
var marqueebgcolor="#FFFFFF"
1 S7 S7 x( r8 F, g+ i2 E//是否能暂停 (0=no. 1=yes)?
' i2 c' |/ @: y7 h4 ~1 ]1 s1 pvar pauseit=1
$ ^  Z& G0 Z  t9 B" ^
- }6 s" m4 [1 }. s# V: q//修改显示内容
9 l! u1 |6 p& f8 f+ i' E' mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* {' `' U  Z3 K, h. r
( `: k- z* S. B* R$ J
( h& Z0 Y) y/ \% t* g0 c0 H) H/ J////下面不需改变////////////" f( z  b1 V+ v, a" x( Y3 R

3 t0 M5 w- N! M  Nvar copyspeed=marqueespeed' e. L7 ~+ i9 L. ?' s
var pausespeed=(pauseit==0)? copyspeed: 0
7 \- V0 O8 Y% x1 g& ivar iedom=document.all||document.getElementById
6 [1 S2 O; P4 h3 C$ H( @if (iedom)- F' z8 M! ^. a5 d- B. _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 ~4 \; A2 d; Q& b& vvar actualwidth=''
! H8 k4 X' |: f2 I0 I- U. \: m6 Avar cross_marquee, ns_marquee- Z2 U, C& q  P

, ?7 P; [  g+ D; _. y# n$ efunction populate(){- V9 t2 n/ A& R  S3 q! x/ e
if (iedom){' }/ Y+ E  G5 U( B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- O& Q" @* s# F- R! dcross_marquee.style.left=marqueewidth+8+ u- @4 |& W: p4 Y, I
cross_marquee.innerHTML=marqueecontent
1 ^- B3 d: x  I' q% ]$ _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ d2 T* d4 f+ t* ~
}
5 {2 D. N# c9 ?3 g  Q- _else if (document.layers){. h  y4 G, c$ w) N6 l
ns_marquee=document.ns_marquee.document.ns_marquee2
4 x& _' X! D7 Fns_marquee.left=marqueewidth+8
0 ^# l, c! _( e' ^, G- [: m9 Ens_marquee.document.write(marqueecontent)
! G! |2 X7 I5 N4 }ns_marquee.document.close()
0 h( q% w, j+ G: y5 ^# `actualwidth=ns_marquee.document.width4 ^9 U$ \1 w6 l, J5 s
}0 U0 i! i( `' F2 I+ K+ E
lefttime=setInterval("scrollmarquee()",20); V" `0 f5 {# Q6 @
}
; m8 d1 d6 h+ F" v" N5 mwindow.onload=populate+ u9 A! O& I; ~$ r' e
7 r, U; f/ R6 A0 u# y! H& v7 q
function scrollmarquee(){2 G! O0 J- U+ X9 f; O% [6 I
if (iedom){
; p3 @" `# i# uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 k& F' w& Q4 Y2 |3 D' w& b" Ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ ^. E, C- ^& s1 v* A, B+ \else! C3 o! I. H  L  a2 |/ o9 o
cross_marquee.style.left=marqueewidth+8) H9 {* r' O$ c: y  |& G4 W

+ I2 N3 H& Q, d3 Z3 e8 a  _}
3 s+ t' v- w. J1 z8 d, telse if (document.layers){" I& t+ m% ]" c  }
if (ns_marquee.left>(actualwidth*(-1)+8))
7 l9 d/ P' w5 ?ns_marquee.left-=copyspeed; C6 e( C" c; u- ^6 v
else
2 f4 N! ^$ [" }9 a5 ^ns_marquee.left=marqueewidth+8
  @+ _# h  X  G5 o( k; o7 j}
2 \# ^7 M7 D) A. ^0 _}$ l$ j# R3 |8 X0 h1 [

" s2 l  @+ B& oif (iedom||document.layers){0 J: B/ W* Q" W  |* c
with (document){1 \& \+ N7 N- H0 C* V- r( Z) q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 `' i" d; V, N$ Wif (iedom){5 ^) x* P+ F0 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# V0 U% H. z+ F- H5 d2 owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 }! m* f7 k" p2 \2 W# p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: \0 j. \+ I9 r1 l+ Qwrite('</div>')
# X6 |) h0 W! z" A}' D4 R9 W# z2 b0 D4 f
else if (document.layers){
8 ?; x! ?3 v- ^* @- T- ^# J8 Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 m" U1 t8 J4 p) B8 {- ?8 Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! `/ ^0 ]! c" f9 ?, Cwrite('</ilayer>')0 y# H; q* O! Z6 }3 p
}
2 i& W# T' v& l2 _! kdocument.write('</td></table>')/ O$ ^% i/ `$ O! P$ c! R
}
! F6 X6 q4 I4 ?, [, h}* ?( @0 {- g  P  o8 m; |1 E
</script>

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