返回列表 发帖

网页之跑马灯文字特效

//修改宽度( P+ D! t( W8 Z% f5 u' D4 F
var marqueewidth=300
$ x: r1 A7 I5 l' i" M# _//高度( ~3 z8 x$ h0 [) A/ k9 N+ Y% _
var marqueeheight=254 g% W" o# x. W6 ?4 v0 Z) R
//速度(1-10)
( E" e) C) W& l: G. z  ?2 jvar marqueespeed=3
7 r# q$ I" m9 ]//背景颜色
) x% S. M6 S8 t* w& {3 C! w* bvar marqueebgcolor="#FFFFFF"
# {) g6 D( G6 ?2 ?//是否能暂停 (0=no. 1=yes)?
, _: L) L7 j) M+ l4 Fvar pauseit=1: Z1 [5 g$ Y8 f/ O) q8 F; z
7 s/ i' D; V+ _0 n7 M  [
//修改显示内容( K( ]1 c' X! }. @; D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 Q" k/ h6 q" _4 [' u8 K( Z, r, ~0 i0 T; }' l
  l6 }0 q' ?( J5 g. L
////下面不需改变////////////) P0 F+ r. S% F/ L( {4 [/ l
& d3 `8 F& I& d$ H0 R( @4 P
var copyspeed=marqueespeed
. w3 P2 V' s) [, Q7 w; f) E" A0 _* @$ avar pausespeed=(pauseit==0)? copyspeed: 0+ y3 j" F  i5 H& V: a
var iedom=document.all||document.getElementById, z+ s7 k# M" m& J; h
if (iedom)# t& s6 l+ \9 c: s  w% D  k! k% B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% j9 v$ V5 j' W5 s* N
var actualwidth=''
+ j1 \6 o! N5 I2 ^) Vvar cross_marquee, ns_marquee/ f, S. d% J7 Y( {

6 X: {1 ]+ X  N: {6 A5 i* pfunction populate(){3 U+ Y, T# ]* j& G) T
if (iedom){8 X, U; r. C( e, n7 I& t: S5 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, Z: R0 ]& P: I0 D  rcross_marquee.style.left=marqueewidth+8" h7 R" W3 X( v& L6 a8 V9 S
cross_marquee.innerHTML=marqueecontent& z( u1 g/ w3 t" e& @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 b: a2 g" d9 F
}0 S: Z2 J$ ?# N+ t' B/ n5 f
else if (document.layers){
9 Z8 L, k  U' a& sns_marquee=document.ns_marquee.document.ns_marquee23 p( P$ k7 j, m9 s
ns_marquee.left=marqueewidth+88 r3 H$ Z( ]. e: u  W) t0 R" S
ns_marquee.document.write(marqueecontent)0 e- z; \4 \( O9 m! T0 s; F
ns_marquee.document.close()
3 c8 s4 |( _( e( Kactualwidth=ns_marquee.document.width
2 s* W( k9 C1 V0 G0 y% r1 G}
0 D0 a! L  b& d4 }) wlefttime=setInterval("scrollmarquee()",20)
6 g3 u8 ?8 w2 ~/ v  W2 _0 O  K}/ X2 w' }6 r# s) c# H, `. H
window.onload=populate
: S! D2 K4 }0 }% L9 }0 w0 G- D0 D) D$ _7 _; E1 i; k) T
function scrollmarquee(){
# N, Q; q1 t0 k4 |2 D* mif (iedom){/ m8 X( ?2 W$ S4 R  m' _# M# b1 l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. W- J! {; u$ _; l1 j2 X$ ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, `" E0 }, \3 _
else
1 F% d: ^7 n; F2 \+ Dcross_marquee.style.left=marqueewidth+8
% S( l# s" J( T4 V/ `& D. W6 [/ g  U' N/ _* S
}
1 G6 q/ N9 t- R; @5 Belse if (document.layers){
3 S2 N# r4 i! F' Y# X' y5 qif (ns_marquee.left>(actualwidth*(-1)+8))
  b, ^' }# E1 ?# F, ?. h4 g9 s/ }ns_marquee.left-=copyspeed+ a0 l7 Q0 h4 v% {" \: Y
else
4 ]" t; Y2 f8 T9 H% ~) }; ?ns_marquee.left=marqueewidth+8
5 [1 Q2 V5 a+ M% ?, r}
% {) C9 e  @; I}! Q; G- ?# e, O; i; P6 z
5 A/ v6 p9 Y3 }1 O
if (iedom||document.layers){
) u/ S. {9 F$ C" Q3 y8 Rwith (document){
; [! W6 l  c! ?( @2 h6 S7 `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& m+ ~9 j) {) u) Z, P
if (iedom){
3 `4 L# A" A3 Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 H. ?5 j* I: Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ ^& _6 y# a& ~* y# _: fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% l6 Y+ {) O! r2 i  _  F6 ?+ ~; Wwrite('</div>')
2 f& `7 b5 E- v0 K}
$ q2 t1 k9 o: W5 |else if (document.layers){/ @0 j5 ^( N& i, K- ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  f2 z9 a/ q4 u5 g' G1 Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 o* E/ J2 q6 n" L% Vwrite('</ilayer>')- o1 C) F; w4 t$ _: z/ \
}( H2 `+ U$ n, w* j
document.write('</td></table>')
0 p. u0 f) w9 [* T- X( r}- K; Y( r% G' I
}2 A# X& L/ H0 f, \' g+ G7 z; @" Y
</script>

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