获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ R5 V2 b8 g+ I3 yvar marqueewidth=300
7 t( ]. H" y# _4 \0 o//高度' y8 P3 S$ ]6 i8 y
var marqueeheight=25% I* A- t, P( q" \' D% I2 e
//速度(1-10)
7 l4 H: R( ?/ ~7 w: kvar marqueespeed=3
  b5 z- I5 D' q1 x//背景颜色2 E7 ~' v. V$ k
var marqueebgcolor="#FFFFFF"5 b/ F) y% Q; M! d
//是否能暂停 (0=no. 1=yes)?% n* Y9 l! G8 Z( H, x
var pauseit=15 h  F/ V4 v5 U2 ?5 u
9 b/ Z4 m% }) Z+ J3 D
//修改显示内容
  I) \5 {! V4 y! {; o. o9 o6 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; G7 @5 q$ Z6 {0 U" J6 g& A" c7 v' P1 z' o
4 G0 s* q9 A5 J! B: D- `- q
////下面不需改变////////////5 P+ b/ F: Q2 [6 q& P. a
& M' \, f" a9 s
var copyspeed=marqueespeed
. o" Q6 |! Z# j) [# a4 dvar pausespeed=(pauseit==0)? copyspeed: 0; J: Q7 m; X% C- O; s
var iedom=document.all||document.getElementById
3 u' K6 m6 @3 F; r/ d* V; i/ xif (iedom)# k, ]: W. h" s/ R; s% m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' x/ I+ W/ t# c$ d$ U, vvar actualwidth=''9 e" F+ L! _9 e: d4 M3 R
var cross_marquee, ns_marquee
; T, T8 u! s  v: ^( ^: |& k; A- X: b" s# p( t1 t
function populate(){
0 i) g- q; A# p. m* P1 L) Aif (iedom){
9 M& V3 \- y- Z2 R9 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 i& q5 U" U6 }& T! I
cross_marquee.style.left=marqueewidth+8' M% d# z+ _0 U8 T& X1 ?, o
cross_marquee.innerHTML=marqueecontent% d& a. J) ^; U& x: t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ e/ ^# C# W' E3 @& \( K: ]
}
5 s2 X% D( @( E# X; eelse if (document.layers){
0 ~9 R7 x/ G5 {* x% y8 V0 qns_marquee=document.ns_marquee.document.ns_marquee2
. G& P  [5 |: R" Q, hns_marquee.left=marqueewidth+84 Y# U5 }' a6 Z; o
ns_marquee.document.write(marqueecontent)$ M% l% s& P7 }" C
ns_marquee.document.close()
5 q" P. c7 n( C2 `actualwidth=ns_marquee.document.width
/ u& X' }# S9 O}9 w) F( H) M8 \) O) a
lefttime=setInterval("scrollmarquee()",20)
+ Z& Q* j. K! Z/ c. q) \* T}; x/ Y! c9 ^; B5 Z6 _( j) [  V* y1 D% @
window.onload=populate
' N0 m1 b) @0 X& s4 W$ D. L
6 e0 n" m( s4 f! q9 P$ S  o: Kfunction scrollmarquee(){% i- R# d' R$ L" _
if (iedom){
5 N% l% l4 p# Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). v6 g/ X  c3 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 ?  S2 t0 d; n: ]/ A
else
7 h1 z4 h% l% J8 Y3 R5 ncross_marquee.style.left=marqueewidth+8! c8 t8 h; n- R4 d5 N4 v
+ D8 V9 E; }5 @, y  P! ~4 u$ ~* E
}. G2 @, y$ B6 D' X) c
else if (document.layers){
0 K$ H2 J3 _) M5 a% A% t/ }: \4 o. O3 Qif (ns_marquee.left>(actualwidth*(-1)+8))2 }: L7 b8 N$ a( b) z! t1 A/ |: s( o; @; ^
ns_marquee.left-=copyspeed1 O/ R/ V( Q2 s. E: o0 z4 e5 m
else3 c7 U9 {  ~  K) b6 q
ns_marquee.left=marqueewidth+8
8 P7 f6 X& n; ^. g# ^% m9 O}9 H& |" ?  ]" G
}
( A1 c  E2 \' E' z
: ?% i4 k) i% g" ~' qif (iedom||document.layers){
( A6 V$ x( N4 N3 b8 r% {& Gwith (document){
* w( a) Y# F, k- S" K$ wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 {& O& y0 [- L
if (iedom){
5 S/ ~$ z5 X* l( l2 T% V- Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 k- k& L, T4 G( Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. R, f9 z( @- fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: e  ]( i* u* }3 ]/ o4 G- H& \. swrite('</div>')  h6 y5 [2 R- `3 Z$ D$ t  J
}
  R) i7 W+ H( x! x# r( z* e+ @else if (document.layers){- v# K( n( ^) S5 G4 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), f2 z% r; D8 V$ q  C/ g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 K, ^% `0 i+ A; f& {write('</ilayer>')+ ~. Z$ |2 ^0 ?. q7 w: g: b( H! B, ]
}6 d) D4 m; j: u- g1 ~
document.write('</td></table>')8 v7 X) Z$ j8 s
}( \) }4 t) M+ w! `$ S1 K
}, u. \6 u3 U5 S5 D
</script>

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