返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 l9 y+ M3 D* {var marqueewidth=300$ ?  ]* j; t1 I
//高度( o) B7 J+ C9 ]3 i# D& C
var marqueeheight=25- ^9 r  U0 l( ^% m5 D* Y
//速度(1-10)
; [* X( p: Y% G2 F: [1 Evar marqueespeed=31 [" P9 J- }. j
//背景颜色( K  V5 t" M2 H' ?. n* Q
var marqueebgcolor="#FFFFFF") L. ]9 s5 C7 B5 a/ Y* f. H) m
//是否能暂停 (0=no. 1=yes)?
, L  d8 R3 \8 F8 |# Rvar pauseit=18 }" g2 ~6 V6 x
6 _+ J4 e4 W! i9 M2 J7 T* W6 h
//修改显示内容- j4 i2 @, w( s2 d: @! J9 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 `+ |# o4 D# X1 l" u8 {* Z, j
6 `) P+ E( e$ {
2 z) I  l# u6 n4 s4 U& S////下面不需改变////////////8 Y2 Y; L/ ]) }

* ^, Z4 ]) @, }. F+ x/ Jvar copyspeed=marqueespeed$ x3 C. t! D9 g# M
var pausespeed=(pauseit==0)? copyspeed: 04 u# i5 R. e6 f' \
var iedom=document.all||document.getElementById* j  ^! O+ F, z. a1 n" U
if (iedom)
) `/ L& R9 x# e5 |1 f% E+ vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). e1 M( g6 L. S# \7 P' [8 O  D+ g
var actualwidth=''2 k# W- l  y5 @& e5 P+ U8 R
var cross_marquee, ns_marquee
* _/ R9 I0 ?# G2 R! t
  n, P$ I5 X. @$ ^/ Xfunction populate(){
7 R. }* a  o4 w# zif (iedom){4 w  G0 m2 p5 b! g. P9 {- d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, U. F- F0 Z/ j6 Y' _cross_marquee.style.left=marqueewidth+8
( t. p, p+ @1 P- M: Tcross_marquee.innerHTML=marqueecontent# j& }7 N+ R# f  o: l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 N- r; T  Y# ^; b# `9 e+ @& f
}; P4 C" w% d3 G: {7 `
else if (document.layers){
1 t) L% |8 U& v8 t" wns_marquee=document.ns_marquee.document.ns_marquee2
/ u  E8 ^6 S4 ]8 Xns_marquee.left=marqueewidth+8
  ]/ G* N2 m+ [) j: zns_marquee.document.write(marqueecontent)  d: ^0 Y: l* h5 P5 ^1 y
ns_marquee.document.close()2 K3 x( J5 {' k% w) m( z
actualwidth=ns_marquee.document.width
/ X( B, j. u% T6 w9 V6 Y}
3 f  p  ~5 R$ k% J9 qlefttime=setInterval("scrollmarquee()",20)
4 U; P# U1 G' n: M. f, s}
, @7 C( a  X/ T: \window.onload=populate9 c9 j3 C9 L3 ^* W& b9 h8 `# h5 B
. C, J- W  x+ K+ m# ]3 {
function scrollmarquee(){
+ g5 Y" ]1 [5 _: n" ?if (iedom){
$ e$ ~; c$ y- X& q, g, Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. ~' p5 U( ]& V  H; Z6 r& z; Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& z! ]; X! N4 L) m! p
else( A* a# E, k, f" F# p4 O
cross_marquee.style.left=marqueewidth+8- I7 o/ {5 y6 g+ M

* b7 w' j* Z' `+ c5 S! Y3 U}! M3 I) Q* z, d! Q- M
else if (document.layers){; q  X# E* U9 h& h
if (ns_marquee.left>(actualwidth*(-1)+8))( B+ e/ W  y, F. U2 u  P9 O
ns_marquee.left-=copyspeed/ G& [; s1 `$ j  K* p# D8 a" m1 n4 S" k
else8 E/ N; c  F9 }
ns_marquee.left=marqueewidth+8
' @& W9 j$ l: A  d+ Q7 F& N( E}
8 V- y  q9 ~7 A}
+ w! J+ u- v* ]8 i
4 T/ h% I, T7 ?  Hif (iedom||document.layers){
) ~+ _7 j; S) u7 hwith (document){1 w5 e- Q! o* Z* G* y3 U* V; k1 `% O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* h: j  g# O; H$ ?+ e) l/ ]- S( s
if (iedom){& \4 G2 y+ ^0 `# J" ~( Q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# \& M! K4 Z' r4 Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): X' D+ S. a3 n- n) a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& J7 ?) K& J% A$ T
write('</div>')
( ?& I1 N. s( H% P$ q}/ h9 r* M; {% j, x/ m
else if (document.layers){
; w# F/ `/ t$ Y. }; g& x% R) ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% L! Z5 M% Y$ n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. i: S, \; y, P2 {write('</ilayer>')
, ?% P2 v. z" x5 @" y; l}
- A5 y! r/ H( x/ Q9 a4 Fdocument.write('</td></table>')3 h* e. Y8 d# w: R
}; S- m# T& O3 ?% r
}
) `( g0 ]  M. M2 {</script>

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