返回列表 发帖

网页之跑马灯文字特效

//修改宽度- M! B: j5 p( X2 f" R: M$ r
var marqueewidth=300
" T" y2 q8 q( r4 I) w//高度# }' u" ^. F$ s& w: g# j
var marqueeheight=25
% m6 U7 e7 t4 E; I0 z! v, N//速度(1-10)' ~+ i9 ~. e, ^5 \% ?
var marqueespeed=3' K9 ]( X$ |! b% ?# n# A4 N2 A
//背景颜色# t/ n+ o4 G( D# F. \, o# y
var marqueebgcolor="#FFFFFF": S4 i+ S5 M7 u+ J" o
//是否能暂停 (0=no. 1=yes)?
6 d3 I4 t2 p2 B- p9 Zvar pauseit=1
' ?' v, N, p# w8 j' F8 @+ Z
" D1 F+ a, I7 A3 S//修改显示内容/ F; k3 J9 ^7 ^9 S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( f4 h) e2 f0 e3 g2 e* m8 G/ f5 n7 K. s
3 ~( B( R  [- j/ W: V9 c
////下面不需改变////////////
# D* Z# e, y( E& o1 f
1 Y1 P+ N5 l- ?" }6 z3 m# Kvar copyspeed=marqueespeed
1 O" H# b* e5 O! V) z# ivar pausespeed=(pauseit==0)? copyspeed: 0% n% H5 f- u9 u/ h, T9 D! i7 u1 X
var iedom=document.all||document.getElementById
  g, s/ w# H& I2 qif (iedom). W3 x6 S5 q* y3 l4 z  ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 A! }  ^( U" j$ _
var actualwidth=''! u! H8 c; r( z
var cross_marquee, ns_marquee
4 y9 s2 n8 S( y4 ?/ g2 ?1 O$ f/ f
: |% [" k7 @- y8 H% o: i+ ffunction populate(){
1 ~  m" T; q4 f, y9 Sif (iedom){
- a, e$ q4 g+ Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; I  \8 f, o4 o9 F2 j
cross_marquee.style.left=marqueewidth+8' M) W' R) Q3 _. k
cross_marquee.innerHTML=marqueecontent, j: e. l$ _. p# g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ r0 @8 H* x4 |: f}
4 o6 }8 e- G+ z! ~8 |else if (document.layers){
& [: x# X6 `5 |: Cns_marquee=document.ns_marquee.document.ns_marquee25 K" }, G) e+ e5 x8 x+ e  S
ns_marquee.left=marqueewidth+8
0 Q  M" Z, l8 ^1 p4 H  cns_marquee.document.write(marqueecontent)
! }0 g4 |+ S/ f* x7 E9 Uns_marquee.document.close()6 k! L# S" T. X/ W: ^" c  L  p
actualwidth=ns_marquee.document.width# D& a5 Q$ c2 _( J
}9 s, }6 ]- F, k" A5 v
lefttime=setInterval("scrollmarquee()",20)( l' A  t6 ^: i  X
}
) P2 v8 c3 f" U! l" t; P1 m% U% ?window.onload=populate
( h5 R% D" X( `. f' H. C# x
; |! _% P$ O2 Afunction scrollmarquee(){
, a7 G* m. Q" P1 pif (iedom){
" j# K0 G+ N# w9 t' @0 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# N2 S" O6 A0 j4 R+ ~" U3 @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# w$ Z2 h" P# \' B
else
  D+ U" [; e' W# ?5 C( Q* R" R0 across_marquee.style.left=marqueewidth+8/ g0 e* n  }! T0 R) I3 ?

! p) F! x) _: I}+ X7 E% J2 _: ?' U1 @& K4 F. P
else if (document.layers){- p9 C7 ^# U+ M" A; t+ \: X, z9 ~
if (ns_marquee.left>(actualwidth*(-1)+8))3 o' V! H; ^8 n6 G# @7 {( u5 o3 Z
ns_marquee.left-=copyspeed. J# C0 R5 E4 G) v* m
else! P: b1 X; X2 J% M8 H4 z5 U* v, S
ns_marquee.left=marqueewidth+83 b& F6 f& I5 f. U5 y" T7 }0 E
}
" j" y5 @) ~$ F. ]: i}2 o% k9 m4 w# N' M2 j# O  G
$ M. U8 a& G, q- x
if (iedom||document.layers){
* N, B% I; N# F6 R3 gwith (document){
- n6 e5 s; F, k4 g* Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 H0 x5 i; z8 ]0 E2 U
if (iedom){
( K5 u8 v( g5 Z% H9 {9 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 w+ ^6 y  {- E, v: u) e  s5 V- B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, m; r( [/ C; s9 E: ?! F/ lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 S  O7 r& Y  w) zwrite('</div>')4 i: J# ~' Z6 g. @# S% v3 |
}# |! w7 E7 O; M1 a/ x  o; N3 Y
else if (document.layers){5 g* f0 K+ y, n* g' b  L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), c0 S/ m! }2 [& s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& u% G8 {/ Y$ rwrite('</ilayer>'), l# U; t0 z( \% i! z$ s
}
/ @8 \4 u( Q$ J6 E0 r- adocument.write('</td></table>')
0 u' B/ ]3 D4 N! y4 ^}
% @9 g) `4 E- K1 W3 O5 p5 Y}* y, G& x& d7 [% e2 Y
</script>

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