返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( n5 Y4 @* e2 R' w. Yvar marqueewidth=300
( {& [6 o0 H* ~) R' ^+ t7 [//高度' {  D  _" U5 V8 c" n+ H3 O
var marqueeheight=25
. k& r9 b- [7 e5 Q  [6 D7 v$ \//速度(1-10)* T2 A0 r# g. N8 @& a
var marqueespeed=38 e2 i. x% a8 m9 e& E% b$ L
//背景颜色% p4 H# ~: j6 B: Z5 A
var marqueebgcolor="#FFFFFF"
! z1 Y& [* W: v, y8 o  C  o' m0 K//是否能暂停 (0=no. 1=yes)?
, H% M0 P& r( B$ E1 l$ G+ \var pauseit=1
: ?* s5 \' P9 D4 V0 i: ]
- m0 i% e* w% \//修改显示内容
7 x, a( D$ U( C3 A+ [8 X$ B: jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 b: g* \! ^6 _9 V7 E9 c' S3 K$ }! _" e
* h7 V( m- E" t6 ^4 D9 |( U& d
% b1 C, r! C. }6 i////下面不需改变////////////0 ]  W9 C  ?4 d8 C& p
; e) j1 m& r! ?( W8 u( p
var copyspeed=marqueespeed' U# N, S( T; k  q, Q
var pausespeed=(pauseit==0)? copyspeed: 0
$ d; I; M% g0 L- Ivar iedom=document.all||document.getElementById
! Q4 ]+ c8 N! p; xif (iedom)
# a5 ]: y1 W& G2 Z3 R, ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) R% K. N/ q5 Avar actualwidth=''$ r" |( V" ^' V+ N# k) {
var cross_marquee, ns_marquee
6 j+ {- Z, D* J7 M: }1 `  H. D' p* P# G2 M; p2 D
function populate(){
6 Q# {# |6 w& r' X4 e4 D0 i3 }2 Iif (iedom){) Y+ j/ `0 W2 Z' F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! B8 T% J( n" k1 F) ]7 Lcross_marquee.style.left=marqueewidth+87 v9 h+ f8 k2 m% p* u
cross_marquee.innerHTML=marqueecontent) N9 Q; ]# t, p/ g( f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 h- A0 R. w4 U
}
7 D4 H% h# ^# t6 b# E& O0 Velse if (document.layers){
0 C6 \# Z. ^3 q2 b! x$ }ns_marquee=document.ns_marquee.document.ns_marquee2% @: Y+ Y$ w7 ?4 i& ?
ns_marquee.left=marqueewidth+8
0 O7 M. q- E) G# |9 dns_marquee.document.write(marqueecontent)6 {# j8 n: W, `2 ]* R0 [
ns_marquee.document.close()! t1 }8 q5 B: Z5 X
actualwidth=ns_marquee.document.width
' k. D, e( v8 Y# B}2 g/ B; U. ?3 e% U: f2 t  R
lefttime=setInterval("scrollmarquee()",20)6 h. p( G' k) Y( R& V  H8 }
}
  I: W0 H+ H2 J1 x6 k- |window.onload=populate
, C3 k* p% T! P1 f  q/ N# I8 P/ ~8 @8 S5 m+ W
function scrollmarquee(){
! s1 W4 R, y' e0 Kif (iedom){  L. m# L2 v# s1 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). F2 k# w3 f  H3 L0 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& d3 s' _- U/ D2 j
else  N  y1 b6 {# t9 l% ]+ X
cross_marquee.style.left=marqueewidth+8% x" [2 q8 Y' K7 o8 _' }

1 m& F- E$ l1 b2 c, B}( q0 I5 m# |4 P
else if (document.layers){
1 R7 L' U; R" ?# x6 r6 iif (ns_marquee.left>(actualwidth*(-1)+8))( B: d( Q- Q7 W3 W- i4 N6 S& y
ns_marquee.left-=copyspeed- b! I0 Y& D  K* B% N
else6 V% I4 d; I, [
ns_marquee.left=marqueewidth+84 C& W% I, R9 I5 c! k- ~  m) C
}: {6 f: k+ S, i, S0 ?
}. G' C. s/ _! A- f

" u; m. a4 O$ ~" |% t. L! C1 Uif (iedom||document.layers){! j; q+ y4 w$ z  g: `
with (document){
; d5 Z& H1 ^0 L* u+ tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 ?" i/ p2 b" D" `if (iedom){- {4 v7 z3 D) B" V  Z! u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): M% Q7 f! r7 |9 ]6 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 _. [. j8 s: T+ P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* p" ^' s/ `9 S8 B3 R+ c+ Hwrite('</div>')
3 G  \8 t/ C$ e' R}
. ]* ~/ \9 p1 n- Delse if (document.layers){
2 ]1 r' _: D# U! f- owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& B: D- N+ D# t; F) S/ l* }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- ^4 ^4 M" n7 c- _8 ]
write('</ilayer>')
, w! f# k8 t% |1 m( p}: k/ i% j. H& m- p
document.write('</td></table>')
2 O- r' l- z9 c8 z; V}/ q. F( }% |4 `) z1 M! v
}+ N# g! Q( x+ i
</script>

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