返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 N6 L4 i% M( o8 N, C3 K; v1 I: v$ E
var marqueewidth=300
7 R: R0 q- f' s8 Q, b8 _: N//高度
  E# m% e3 |* {, L! ?var marqueeheight=25
( p/ S+ d7 ]0 D//速度(1-10)3 h! ]4 j, A3 j
var marqueespeed=3
3 }# u$ m! S- Y1 ~) J//背景颜色# k7 U2 {( L1 u5 ]
var marqueebgcolor="#FFFFFF"
- z" I5 l2 U7 H9 M* |7 Z//是否能暂停 (0=no. 1=yes)?7 T5 t  {2 d5 Y7 g* H+ i; Q
var pauseit=1
) I4 x0 F1 }! s( w( ?' @- O( F5 E0 J, S& `) U7 b# _' U- {$ `
//修改显示内容2 G2 X# s( l# n. s  \0 ~5 N; ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" T+ S) A; f) U4 X$ R
. }4 H( j( `& H& M8 S  J: g( V, `1 M1 z0 U* V  X3 L- k
////下面不需改变////////////
% L' I+ l$ T, L) T: M
/ `% S7 ]- V. r- E: X% Tvar copyspeed=marqueespeed
4 r* N! p% e. u3 o9 q6 ]( Wvar pausespeed=(pauseit==0)? copyspeed: 0
4 F: ]3 p0 {" w5 _var iedom=document.all||document.getElementById" d( r2 x" C! q* M& J
if (iedom)9 y9 @  S& S7 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 d! {; K  T4 x0 z. e* n
var actualwidth=''
7 M8 x" p3 `) T: C% A  yvar cross_marquee, ns_marquee
8 E# \- |4 {8 ~1 Q8 F) [0 |4 B: g8 U
function populate(){6 Y- T3 A4 t$ t* G
if (iedom){
$ y  V' @  W+ ?0 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) S% ~/ {( b" O
cross_marquee.style.left=marqueewidth+80 d: _5 d. ?' Y! X  u6 N8 a( R! U
cross_marquee.innerHTML=marqueecontent# O' k! E" H! n2 z& M( Y( }  T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 O8 t1 o1 j9 {5 I2 C* A- W2 D}" H8 o. t# g' M% K# r2 A
else if (document.layers){
! }) H/ {: R' I8 ens_marquee=document.ns_marquee.document.ns_marquee2
0 P, F4 R) w) N: f; }3 gns_marquee.left=marqueewidth+8' e7 t1 F3 ~- p/ x! |7 L- {! @6 _9 b
ns_marquee.document.write(marqueecontent)$ A0 e5 L( B+ {8 K
ns_marquee.document.close()8 n8 H; }4 B! K
actualwidth=ns_marquee.document.width1 b1 z7 `, d8 X
}2 ~) k0 P* f, T' |' M3 g
lefttime=setInterval("scrollmarquee()",20)6 @8 o5 w: k$ P0 A" O5 M' c
}. F  d1 E7 ^( R; n
window.onload=populate, T6 A& l' k- U  X/ q
, ]: X1 l) Y. T! q( W
function scrollmarquee(){) L0 o0 ~6 f! G" w
if (iedom){3 ?6 Y' |4 h3 w! U2 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): f" T' e8 ~' b) ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" Z. g% m% B1 c1 J  Q8 Lelse& U, r, B( |3 s
cross_marquee.style.left=marqueewidth+8
) k7 \# }* r% A. I7 R, G8 [
4 @/ F2 d* `9 O. b6 `# C9 b$ {}
, e; g6 \. M6 P6 eelse if (document.layers){
% o7 q* N; e* j4 q" _- L+ Kif (ns_marquee.left>(actualwidth*(-1)+8))
# z8 L, F! p- H+ \0 w$ jns_marquee.left-=copyspeed3 d8 m; }$ q# R' U# i
else
( {0 m, Q/ O& h0 |6 H3 _ns_marquee.left=marqueewidth+8- C* x" F! W, I
}
1 P; p9 v6 Z3 f! I( `2 B}
! ?. x8 [$ O3 W- W; I. o" Q: G9 e7 G; _* h3 _
if (iedom||document.layers){! o6 i4 |/ R5 I
with (document){
( t+ M6 u9 ^6 |7 L  f* z, @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 ]6 g* m- p' q% K* |2 zif (iedom){
$ V1 h8 U. o/ Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 r  k4 R8 M0 P9 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 T/ s$ Q, T$ x$ D0 u' ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 p4 \, ?0 h1 K7 p" zwrite('</div>')% z5 ]6 m( d# V: _$ p, I
}$ C/ U$ ~$ G6 ^0 |
else if (document.layers){5 E3 ~2 Z9 v, ^) O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), [. w6 X5 u  B, e* c8 ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. @- a" V* a5 G4 |% |write('</ilayer>')
9 r( C% P4 q& s0 v3 X+ t}
9 W3 l% o" k" p. L* `5 [document.write('</td></table>')
% l, l/ X5 K- l( h/ R" `+ _}+ R: o1 b$ V. a3 t* I' v
}
, h! e7 ~3 |0 w3 b% H4 Z0 q</script>

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