返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 b! l& V+ i- u# R
var marqueewidth=300- k) B8 q  g+ I2 f
//高度6 C) S! ]% l; S  X# k, c; j" N8 Q
var marqueeheight=25" T5 Q7 s4 {5 Q$ k# ?: v
//速度(1-10)
( ]( s6 P3 h2 ]5 vvar marqueespeed=3
+ y" H  m% m$ i4 H2 W2 y- H& x" n& K$ O% Y//背景颜色
' C. k2 _  c0 R8 \7 Jvar marqueebgcolor="#FFFFFF"
+ c: e5 f- W0 B% h//是否能暂停 (0=no. 1=yes)?
* P, E' |" N. A. j! o0 bvar pauseit=1( @% D, B  Y1 d$ a

9 ?. N: |& K" F//修改显示内容# N/ I6 J, s5 c+ [( {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- v, V. D6 \' _2 u% ^: L$ q5 V8 d3 `) W* h
) l5 H8 a( L1 E' ^
////下面不需改变////////////
. z1 K6 z* Y- s3 y
( B" G* g+ G% [2 t$ d# M# v3 hvar copyspeed=marqueespeed
+ q( R6 H+ V4 @! R0 |var pausespeed=(pauseit==0)? copyspeed: 0
: {1 {  `8 J9 Mvar iedom=document.all||document.getElementById( M5 y8 u5 D& S$ D* m
if (iedom)
& P2 }  E2 f2 h5 |/ |) o, V9 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), m: B/ P9 N  A
var actualwidth=''/ ^  Q' D- K" _% [" \0 r7 e
var cross_marquee, ns_marquee' L, [% H1 T) h, z) D3 G

; S4 h8 o9 b' I# ?$ f9 Nfunction populate(){
$ X2 s6 ]) y- y; Sif (iedom){
0 M  x6 R7 ?. ]1 f) a! U. J" Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ [5 J6 n1 g- W# C) c5 Gcross_marquee.style.left=marqueewidth+82 C7 i$ F# o6 R1 ?% f; o
cross_marquee.innerHTML=marqueecontent/ a" s* q- E; F& T* l5 k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# o/ y( h. T# _, J
}
% X8 O2 M1 g  c5 K7 celse if (document.layers){
2 u! h1 Q/ ?7 m- _  {ns_marquee=document.ns_marquee.document.ns_marquee2% J6 @/ U& b/ V( }8 q' d
ns_marquee.left=marqueewidth+8* L: B( S! @: [% ^3 H
ns_marquee.document.write(marqueecontent)
( ~4 y; ^5 h( i/ X: ^ns_marquee.document.close()
8 Q: r4 |! Y' j+ L9 H" Cactualwidth=ns_marquee.document.width7 ?- @) V8 j$ M) y
}
, m5 R/ _0 I% V; v6 hlefttime=setInterval("scrollmarquee()",20)
6 @: E. D' `7 o1 i3 D}
6 s( X/ R# S( u5 |$ ~window.onload=populate
0 E4 y6 W# o: O! T- _( r7 ]/ B% Q% h/ l; B
function scrollmarquee(){1 a# H6 I2 n- i- w
if (iedom){
& {6 q9 ]2 C' }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& E/ `8 `/ q% N9 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 ?1 O# Q/ w0 t& `: F5 L" N
else4 X9 c- Y& E, I# A
cross_marquee.style.left=marqueewidth+8
7 a/ T4 Q( x4 Y2 y; M2 u' C: ?( o5 Q6 z
}
# [/ }) Z( Y+ eelse if (document.layers){1 O* `; q5 n, {2 C' _+ `* {
if (ns_marquee.left>(actualwidth*(-1)+8))* r  T0 B0 Z" H; E9 E5 a' g
ns_marquee.left-=copyspeed  A( T7 s8 m5 i: _' C& r1 K
else
% ?3 O3 p1 R1 Z- T# b. Nns_marquee.left=marqueewidth+84 y2 p3 Q* b4 P8 R" B
}9 L/ H: ?% b( T7 U+ {. l3 ^
}
0 w$ n" E6 V2 g/ ^3 c7 Q4 `: o* Z- @, L3 `' `' {
if (iedom||document.layers){
* |: a8 c) i0 n8 |5 o' Swith (document){  ?1 G( m2 A$ V& d( e" n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). Y3 w# o; I  k% B
if (iedom){* x3 O7 W2 q5 K. s% e9 ^5 U/ Y' T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ a  G' @- D3 G/ U' Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 N$ |5 T9 }9 J' }& Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ D9 N6 T; i2 Q" c
write('</div>')! g9 h8 h8 A2 T! m& l2 C
}# `( [6 \8 V& }
else if (document.layers){: M* k  r9 o$ k4 p  S4 u/ I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 j$ A4 D1 g4 t1 k- Q4 I6 E+ `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% ~9 f6 r  ?' b5 k6 M% a$ y
write('</ilayer>')
# e* f3 B) ^, N- D- t$ M" m}
8 q0 u) d% a+ y" Odocument.write('</td></table>')8 D4 B4 i: X# r1 ^7 Y+ ~8 o+ V) G
}
/ a. q5 n, O4 n( N6 i/ I}( t- S! t' J/ i4 ~' r
</script>

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