返回列表 发帖

网页之跑马灯文字特效

//修改宽度( Z) _, d- S. o2 r% c' F
var marqueewidth=300
3 N$ T8 c2 J) s) p) [7 F//高度7 t* Z. t. V) j  ~
var marqueeheight=25
7 |" \1 q# d& P//速度(1-10)
( x( v6 \0 V+ |! a5 j+ J' B7 Cvar marqueespeed=3
, J5 k% {6 L, y& V//背景颜色8 a' ?) i  P2 {# V8 h
var marqueebgcolor="#FFFFFF"
5 K) r* {; d1 H: H0 H//是否能暂停 (0=no. 1=yes)?
2 i  l4 R  o1 W2 x) Ovar pauseit=1# e- N# i& N: K5 V
- n, G! O: W9 Y2 m% P. o- I' L6 c
//修改显示内容0 P3 F1 v( j; t) V: ]+ R/ c! k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( M$ D2 ]& F1 U0 j% v6 b

- ]" k3 ~8 `8 m. P+ ]! l
6 |) }( c7 n; F( g4 _////下面不需改变////////////
1 f2 c' X' d5 R
) z7 _6 @& X$ y+ Qvar copyspeed=marqueespeed
/ {, x- v- [" I1 J9 S& F6 i5 @var pausespeed=(pauseit==0)? copyspeed: 02 u7 b% s, E. u
var iedom=document.all||document.getElementById
- n6 g6 s* E  D3 k) z7 @if (iedom)
/ K& B! \: i' m# k' H8 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: \) G8 K: @5 o" s4 H4 Avar actualwidth=''
% E8 i! Z% T) M3 _& R0 R  K9 ivar cross_marquee, ns_marquee9 T4 m: B/ v# X8 n" A8 Z

  {. u; I5 C; y1 ~7 C7 F6 i' rfunction populate(){
. A5 x, x; Z6 M+ [5 Sif (iedom){. U5 k3 Y( B0 G3 U. Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ h" w8 X2 n3 g" q5 l9 qcross_marquee.style.left=marqueewidth+8
$ A7 q0 N% V) Q; V( V3 O. _cross_marquee.innerHTML=marqueecontent
0 c: {$ S0 W5 m& T, z$ I& v, Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# B" D  N/ X# T% J' g8 Q$ S}8 H2 Z4 X; \7 C* y8 b0 y5 X) G& [
else if (document.layers){
, E( M7 \1 ~7 ?1 Xns_marquee=document.ns_marquee.document.ns_marquee25 M, u) M( h, M, H2 p$ h
ns_marquee.left=marqueewidth+8
9 z$ |" H8 n7 z: b9 J9 }/ z* Ens_marquee.document.write(marqueecontent)
! s9 |- N7 H- \, ^3 Bns_marquee.document.close()
& f, ^: i% `4 c( [actualwidth=ns_marquee.document.width
1 E3 n1 O7 r0 ~( m}
4 J% q/ Q: _; b& s7 }lefttime=setInterval("scrollmarquee()",20)
$ W, o7 `* `/ t: }/ ]" V}) O( ^+ ?& C/ t5 p7 w) T
window.onload=populate
' f7 v6 u( ?& f) r0 w
" i& E5 r+ H$ X6 Q# X3 Q- Z+ Ofunction scrollmarquee(){
! q7 e$ r3 Z( z8 l+ b, @if (iedom){7 ]6 k. t; _7 H; ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 b: _6 U" M9 R' \  G8 \$ ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 `" @( c1 y' R4 s/ p1 ?3 Q( x- b
else: K9 F+ g9 V( _& H% p5 I
cross_marquee.style.left=marqueewidth+8
1 z: e( A& b- |6 `, u7 R5 r' r
0 g; O5 m( s( k- n/ f0 R}1 X5 r2 [  d3 B
else if (document.layers){1 m$ o8 X2 G3 X1 n: F) e
if (ns_marquee.left>(actualwidth*(-1)+8))
" b) C8 X. z- i9 m# y9 `6 {ns_marquee.left-=copyspeed
5 }' k; w! v0 M* helse
. c' x2 J/ h. S; ^  e2 w4 b$ t  cns_marquee.left=marqueewidth+8  w9 [) x6 j$ k1 ~) `0 V! `- ?# J
}0 b2 V6 s" U0 {
}
* s9 z7 `; Z( z5 t2 K" S- P
# |& k* D8 i/ c9 w+ ^  sif (iedom||document.layers){+ J" W( f/ [+ m$ `; t* j* j
with (document){
1 n2 l& i0 L! Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. A( c6 ?6 ]1 @# Aif (iedom){8 X6 q* M! F' Q1 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- H. P% \8 L$ J: pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 I) l& K" Y. E) R$ Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- A0 m- S; Z& j) d) V' mwrite('</div>')- u/ I2 t3 K6 {8 X5 j/ j
}) d4 n, [4 Y; W: @2 O: f! q
else if (document.layers){# l: L  M) D& v0 }  D: i( A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! u& f, s' F2 q/ `! {( P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- c' o- z/ B9 g- z$ H+ i+ d7 j
write('</ilayer>')
- n5 u' ^9 A# H+ C" ~2 h}$ F  [7 b/ M) A9 e1 L: L
document.write('</td></table>')% T) q- k0 `+ m9 t+ O2 s! b* |
}6 e& v, x  c+ O/ t3 D
}) Q4 @( o( \  |
</script>

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