返回列表 发帖

网页之跑马灯文字特效

//修改宽度  H" a+ a: r7 _: ~: }
var marqueewidth=3004 ~. V/ H/ j' k, o1 m
//高度- G0 L* {0 [7 {6 s& P* E  n7 R$ l' d4 y
var marqueeheight=25
7 N4 ?2 S: C. A: `//速度(1-10)" H) T- ^+ q& z. @' \4 s
var marqueespeed=3  y* _) H( u3 y3 I% `) H+ E" @2 @
//背景颜色; ]: i/ n: q( y- e' S
var marqueebgcolor="#FFFFFF"
# ]2 r. U- H6 ^; Y+ j//是否能暂停 (0=no. 1=yes)?
, G4 I' F/ x; X7 z7 D# f  @0 o0 nvar pauseit=1
1 D4 K; P3 H9 |, F
1 O( V, U; a' s; N0 I9 e# a! `//修改显示内容) W/ p$ u: [8 c' c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 s( S5 `$ v* w/ A" i

2 H: {) v9 {4 f9 n
; z) ~4 N0 S  A% }  z+ Q" F////下面不需改变////////////
0 M; c, q0 U/ K* [# }7 s0 X) U! y* w' S
var copyspeed=marqueespeed
; X) [$ f* c# i$ e/ b7 jvar pausespeed=(pauseit==0)? copyspeed: 05 A) Y$ c! A5 V" T" Z7 e8 ]. D
var iedom=document.all||document.getElementById/ g. q- h: H2 s' W9 {) e
if (iedom)
/ I! r# Y1 ~5 m3 s2 T& tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% T2 a& W  [  `* D8 J2 vvar actualwidth=''3 [7 r+ s: z8 m3 ^4 H3 G; r" S  ?
var cross_marquee, ns_marquee
( ]5 y( ^& X: D: \! Z2 x& |% D1 v$ V: a; Z9 T/ ^
function populate(){8 j! k) p8 s* ^( U' N- Z
if (iedom){
9 i  ?( j* n' a" ]2 ]+ e( T) bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ J% }# ?) H! s1 F7 Z: ccross_marquee.style.left=marqueewidth+8
7 ?& l; O  h2 N0 j6 Ucross_marquee.innerHTML=marqueecontent( ?( W- j& {* c! K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. k. ~7 L1 P& t0 `/ j
}$ t& Z6 i9 f: `. H- g; z
else if (document.layers){
8 B% j, t4 ~: u9 b% u7 b% fns_marquee=document.ns_marquee.document.ns_marquee2+ q+ A+ n8 l. X, u, Z
ns_marquee.left=marqueewidth+8( \' e* ^) R" o+ O' _$ E9 T. k
ns_marquee.document.write(marqueecontent)
  V* ^6 K4 @1 P2 D% D1 w# Q2 D- zns_marquee.document.close()
4 T$ J$ L& }( l/ o9 W1 lactualwidth=ns_marquee.document.width2 d) N! H' m' s/ L5 l; K
}. M: N4 u' b7 o. o$ y
lefttime=setInterval("scrollmarquee()",20)# [- @- u& A" ]. \: y
}
, {7 d. \9 x" F! }6 U. ewindow.onload=populate5 f( }0 I) f, R5 U
: d3 Y, V& V+ U. Z0 Y& _4 ]( ?
function scrollmarquee(){8 u# o9 H3 Q9 i& B) {. m, y
if (iedom){
% _( {+ b1 L- j# k, x: U; L1 {; E5 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 \& `/ h$ e4 H: R; b
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( |) l- n" F) S' z8 ]
else( Y5 R4 ~, B* E
cross_marquee.style.left=marqueewidth+8
+ C. b. O9 q2 {, S2 X' n* s& J: W, R' L7 i5 w* J
}
- P; T6 m8 Y# d$ @1 O8 |5 l! {" B: uelse if (document.layers){) }/ Y4 U6 C. ]: K! a) d8 R* h
if (ns_marquee.left>(actualwidth*(-1)+8))9 k, ?  q! ~) m% ^0 R
ns_marquee.left-=copyspeed, L' S5 }4 w, Y" Z/ B4 v% i
else2 S. @2 s3 R& {0 ^% m
ns_marquee.left=marqueewidth+8  H+ p$ X  \7 `' P. e
}
1 c8 s$ m1 s; I; m}
+ p: N, p7 w) C, E: f& f1 w$ w6 |# r( C
if (iedom||document.layers){
/ K/ G- o8 r& L. s+ r6 owith (document){
/ i$ t' P2 S8 W  A$ Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; m" p& C  J  j6 M1 yif (iedom){8 J$ D* u- v+ S) n- J7 G: E5 g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& A+ Q: v0 J. E. o+ W! m2 X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 k3 H! a) m6 l" @, q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: d8 |8 J8 [  T! f* R- C) K" Q% Ywrite('</div>')
8 G; i- v4 i! V' }5 |  K}, i. I6 D, Z5 n% C1 h5 \# t& u
else if (document.layers){8 v. s( e, D9 u- x1 N0 Q; A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 L3 o( w5 p( p# a& W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): Z, B  t) z9 ]( h5 x, l% F/ v  m
write('</ilayer>')$ a2 U/ d8 q2 j, D! m9 [  Q
}& N4 K; N9 C. [7 l9 e
document.write('</td></table>')& f  t' T7 W+ _0 _) C
}5 L# I/ ?" e5 E
}6 S$ \2 \% b7 P
</script>

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