返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 }' q' M! [9 \: a7 z- T0 Z# L, P" n
var marqueewidth=300
3 G4 u% i4 h5 u8 n$ O* Q* t  }1 L//高度
4 ?6 ?( }8 V" Pvar marqueeheight=25
! y  ~( m" T/ k, I) Y//速度(1-10)0 d( ^4 L% i( Z0 c7 T4 G6 `9 e, B! r
var marqueespeed=3
2 \' g! @* W) M1 ?//背景颜色
% s0 z; @! I' c. b) z) Ivar marqueebgcolor="#FFFFFF"* R7 H6 W3 ]" J- `! T- k  c5 V
//是否能暂停 (0=no. 1=yes)?1 T/ n+ A/ _/ H/ w  m
var pauseit=1
/ G9 K( i+ h4 i4 m
8 `5 q8 w! c9 V  S0 i//修改显示内容
% S3 g9 Z* |8 s% E& ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 q0 U1 l3 V5 F' o1 y9 `
/ i4 J: ^  f( D6 ]$ o+ j, C
. l! P8 w8 l: \" A5 ]  A
////下面不需改变////////////- {1 [/ Z3 `$ t: W6 i$ y& ?# r

& z4 _6 }! V+ |# N* ]! L8 \: e& ^var copyspeed=marqueespeed( v$ t2 J2 m8 t% m3 p: v, i! j, I
var pausespeed=(pauseit==0)? copyspeed: 08 s' o3 w5 w: c& ~. S# T" `
var iedom=document.all||document.getElementById5 o- D! a( J' I; [4 x' U- |$ w* B
if (iedom)* E1 A  _0 l5 w, v4 O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 R7 `, R& C: E9 K5 Q/ h
var actualwidth=''
% Q; w. V; N. Mvar cross_marquee, ns_marquee
. [& z) `2 q. h- [, I/ \. R6 C; M. v. Z6 a! t
function populate(){
6 F! }4 S9 Y+ m6 q* {- }# bif (iedom){
' }% R3 U) ^/ p: icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 ~) v4 _% X) R, [; E2 i& ?* fcross_marquee.style.left=marqueewidth+8
( |7 O: {  Q1 s  B; |& Ncross_marquee.innerHTML=marqueecontent+ ?& o7 N* `- ]' W2 l, \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! c$ K2 {' H. o0 Q
}
4 C4 }3 p! k* I! D+ welse if (document.layers){
! V, T  `( O; Pns_marquee=document.ns_marquee.document.ns_marquee29 R6 S: U' s+ _- L2 h$ L6 J
ns_marquee.left=marqueewidth+8
1 z$ F, s) ^1 |3 E5 F$ wns_marquee.document.write(marqueecontent)
5 R+ S- e1 b( J; Ans_marquee.document.close()3 \% E4 o5 I, _$ B0 G+ M
actualwidth=ns_marquee.document.width# S7 {) Q5 S+ D9 D) p, f
}
0 V  z! ^6 o2 p* L$ }4 p) _. {; q6 Elefttime=setInterval("scrollmarquee()",20): S8 \. Y# T. s
}
/ d2 i7 r- A  X4 hwindow.onload=populate5 n0 [+ k& `' r/ T% k% f

% D4 Z0 d. w; h2 F7 |& o; gfunction scrollmarquee(){
( a* R/ g$ F$ s* s" \if (iedom){  G6 y4 N* a6 r% V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ v8 C8 K- }/ m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, ]6 @# {$ X! T" A$ V+ ielse
" |4 @$ h3 Q' a" ^: t- n0 vcross_marquee.style.left=marqueewidth+8$ V# D) d2 ?2 M0 g% y

! z+ E# V. [; }7 N0 C0 R  x}
; |9 b# v: |2 T/ t: a; p. X6 p. `else if (document.layers){, o  \9 d( E5 l. D4 r, v( I
if (ns_marquee.left>(actualwidth*(-1)+8))  t+ K% m) b1 f* `  W
ns_marquee.left-=copyspeed
0 y4 r" w: m  j3 A  n" E0 [else' {" A8 E4 x+ j
ns_marquee.left=marqueewidth+8+ n! v' ]; S, Y  E/ W- k6 A
}$ [- I& j  m1 P0 T" R
}
4 T6 Z, N/ A* C4 P. c3 R
: I! @  a! v; e4 x' o- `3 J. Cif (iedom||document.layers){. a2 k; ^5 R2 L$ r
with (document){- R7 z( B, g/ J& e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* `* m6 r3 u' ]" pif (iedom){* U! q5 v1 S) v) r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 T- v& o7 y" U( P( z2 t7 `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 c( c) N, a  ^: o# Y7 a' J9 [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  m8 a& j+ f7 _5 {
write('</div>')
0 S3 y: ]) W' a4 E) }1 [}
1 m, j" l; X+ h! ?6 ~1 ^& ?else if (document.layers){* W6 X2 Q5 o6 h8 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- L3 W# y8 W& Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ e# a8 j5 K. E* z: k6 \
write('</ilayer>')# C- X! K4 C9 W: _6 G$ ]
}
0 M( X, m+ A( G$ Z: p' B4 ?+ j' o' [, Idocument.write('</td></table>')8 z- p. t. C2 `& Y2 b; P- Y% m0 I
}
4 ]6 y, r4 ^% B( E) K. A' Z}
2 p# L2 f1 e& ~# B5 ^) `. }( u) `</script>

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