返回列表 发帖

网页之跑马灯文字特效

//修改宽度- p% y4 k+ R# N) X7 A
var marqueewidth=300+ V( y. A! Z$ p
//高度( m0 [% W) ~( Q% d4 w
var marqueeheight=253 v$ {1 u% }! R. x4 L
//速度(1-10)
; n2 a. m$ r8 n/ @  ~" ~. Q% U( Vvar marqueespeed=3$ v4 c- i; u+ c9 J& U
//背景颜色/ m# ^# x0 k. c9 ^2 c
var marqueebgcolor="#FFFFFF"/ r9 `9 e1 {3 i% W6 `
//是否能暂停 (0=no. 1=yes)?3 I; Z4 [! Y8 K) i$ Z: a
var pauseit=1
. M* U& _" b1 D% F" F! Q
6 B& ?" r, {+ b" e1 }3 @% y//修改显示内容
" S6 E; g2 P9 b+ H* w% W% e+ Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( V. H4 j% c) J
9 a0 s( D: o, b6 z0 e
; m; [! k. x( D& L5 I  M$ r
////下面不需改变////////////
# K0 e+ U+ ?, a( {0 Z/ y+ e% T  X
var copyspeed=marqueespeed% c) {2 x& e* f
var pausespeed=(pauseit==0)? copyspeed: 0  B- F8 n( t- N3 E$ V2 n
var iedom=document.all||document.getElementById" n: N. x! l- r+ m
if (iedom)  M' @0 H7 m" q/ @) N  e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ L9 b5 ]' _" j, T" N( X
var actualwidth=''
6 T# g) L/ f  \! c" Cvar cross_marquee, ns_marquee
1 o4 J& P) r- r; G& L/ f' ~" \, @5 ~4 c+ ~5 O; a/ O1 V. x# o1 K  l
function populate(){# h. g9 q) w" s# w4 F9 f
if (iedom){& `# H" C: v2 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 C6 t( W3 ~$ f# _# p$ E; X( V
cross_marquee.style.left=marqueewidth+8
* N8 f; W  q3 j' [& [  Y! ?cross_marquee.innerHTML=marqueecontent5 n6 a9 ]) H! I3 [/ \. |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. u# v1 s  m) z5 j}
4 i7 }7 n0 P/ Ielse if (document.layers){9 w+ l  W+ B' A, K/ e
ns_marquee=document.ns_marquee.document.ns_marquee2
$ w- [; x1 v& y2 b! Mns_marquee.left=marqueewidth+8
! f3 y, w. t/ X) \/ A/ {3 i$ Qns_marquee.document.write(marqueecontent)
5 e+ K; e4 c# Qns_marquee.document.close()& H) r# O" O7 O" @( _
actualwidth=ns_marquee.document.width
  ^" U; N3 G, x1 t}
! ^( ^3 H: J6 h. K9 v1 b" Blefttime=setInterval("scrollmarquee()",20)
# ^1 S+ t- b% S. @) H}$ C- b# N: s6 e3 t+ k
window.onload=populate7 l$ p" j( J1 S1 i

8 W/ [. S  E6 M/ f) I% Kfunction scrollmarquee(){
! w* }0 i4 G( Y" p, mif (iedom){( r" c0 Z/ C0 E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 A/ e6 \# [6 a7 R7 g2 f$ C1 @  W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* y! M3 x5 ~+ O( Z# W7 R, U
else; j- w: {4 m9 D2 h
cross_marquee.style.left=marqueewidth+8" _" ^( u+ d$ X2 e) D
7 G: M  \4 S; B- c& u
}
8 V* ]% Z& F. b+ T  t( ]4 Kelse if (document.layers){. ?) u, @$ K! }  @5 C; W, q
if (ns_marquee.left>(actualwidth*(-1)+8))
6 F( }+ Y  @: g6 J9 cns_marquee.left-=copyspeed
8 A1 F/ V- W3 A1 Lelse
- F! v3 C- ]: W  k4 }% T7 _9 ^ns_marquee.left=marqueewidth+8- Q. g4 J- T1 [3 {: n# X2 S( ^
}
3 N/ X/ e4 ~2 P* Y% P6 E7 v}
/ l8 n& e8 a+ G+ [4 i. T" I5 S* o, Y8 X/ y6 j# e1 A* S
if (iedom||document.layers){
3 A& I% n5 ]9 r) w( D; g0 ?, g; Vwith (document){
" S- M- z/ G, L9 [6 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 F8 m3 B6 o; |- C' R5 xif (iedom){( H% u5 r  V5 j7 X! S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 ?% R" H3 Y# Q6 k. Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ M7 `5 D1 T. T) Y5 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  v/ C- Z, a0 @, ]3 Q# u& @) Twrite('</div>')
2 |9 }9 n6 n2 t8 J% Y}
6 t/ a& ]4 K* S5 v4 p( ~else if (document.layers){
4 N; L1 p( B, l" B9 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 @% v: i5 G+ Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 t( c4 ?, d% D& T) ^, {0 i
write('</ilayer>')- R% r: i. I, n: O# c4 V5 h2 p
}0 u* J0 B& E4 b1 ^7 Q; A1 Q# n+ N
document.write('</td></table>')+ n+ \4 p$ q4 X6 q* [: X+ O
}
! j2 y6 G7 b8 W" M3 s}# i4 I& ]- b6 L) r$ A0 F) @
</script>

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