返回列表 发帖

网页之跑马灯文字特效

//修改宽度, t4 T4 h# M6 E: B( ~6 S
var marqueewidth=3004 T7 Z+ X4 a2 T
//高度
5 Q9 V7 |0 n- [! t; Rvar marqueeheight=25
, K  i" i, g. \* L& E- Q/ b//速度(1-10)7 ?( {! {$ U; N6 O+ O
var marqueespeed=3
$ l4 U& ^1 u& S, g0 i& R1 \" F9 D: E7 @//背景颜色
0 d* s/ L/ n8 r) b8 avar marqueebgcolor="#FFFFFF"+ y  `( c; d% J: T$ S3 S3 d- U1 @
//是否能暂停 (0=no. 1=yes)?9 H: g1 d/ e/ L
var pauseit=1
$ _" }, w+ I% G. O/ }, s* J  v8 W: R$ l
//修改显示内容
8 R( R+ u: G- }  r! fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 [: {9 F& ?/ l8 k2 E# h' x2 _2 C' @1 V+ F9 T' z3 M. i

+ X: R4 H; e6 y! X2 U3 h////下面不需改变////////////
& @1 s; i0 [; H6 B
# E! `2 d# d* C) bvar copyspeed=marqueespeed
& @$ q; ~& N$ v7 F8 r2 s4 c7 e: Lvar pausespeed=(pauseit==0)? copyspeed: 0
# Z) t& B: E& c& ^+ Zvar iedom=document.all||document.getElementById
- O+ }) I$ b( gif (iedom)
5 `5 Y+ l5 o. N: ^; Y3 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) |3 X% Y$ @3 H
var actualwidth=''% @& w* C; U: b9 k
var cross_marquee, ns_marquee+ J' T% s: w9 O; P9 K; E! r

  i5 T8 f  H* G; [- d; ~function populate(){
" `6 a0 o) X3 M% w3 A) e8 [if (iedom){& O9 T1 }- p% @% O0 E* B) Z7 e5 `" h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 O% w$ n1 D& E, g+ j2 tcross_marquee.style.left=marqueewidth+8
' M4 K+ ~  p+ s; e/ Ycross_marquee.innerHTML=marqueecontent9 l( A, _% H) S' O: j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ ~. [( {+ |5 O( e) n  Y}) s7 Q! a$ Z( A0 o; q
else if (document.layers){
- l  D$ F; c, x* d8 J4 z) e4 Sns_marquee=document.ns_marquee.document.ns_marquee2
0 G( X( Q* G" |: ]+ L4 b% Mns_marquee.left=marqueewidth+8
4 u9 ~; c6 m0 xns_marquee.document.write(marqueecontent)
" f1 r5 p' b5 Z! M4 Ins_marquee.document.close()& f- o: j' @; B" ~
actualwidth=ns_marquee.document.width% r9 Y* p* G% K! J. F! ^/ S
}* o5 E2 m( S8 `5 [
lefttime=setInterval("scrollmarquee()",20)0 j+ V" A8 }4 i4 [) D
}3 N; p7 z2 A9 V
window.onload=populate
4 {* w( i& }' m! h: k- L9 b/ N  b$ W" O& O' F! C( E
function scrollmarquee(){
! O4 d( B. L* |2 z, Yif (iedom){
8 O- C' l7 p1 X+ _/ _- M# s9 }4 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 A  r6 c0 J: Y& a: y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 u, q. s! o( _. C1 D4 E
else
9 H- y' P/ x6 X" Ycross_marquee.style.left=marqueewidth+8- G2 B& d, w) A) z( D6 `, ?

4 Q" i' G! ?6 q6 S}
7 g+ |: y+ i; ^& p6 Uelse if (document.layers){
2 U- T+ b% D$ A1 G% [# Tif (ns_marquee.left>(actualwidth*(-1)+8))
) E) @8 D# r! A5 N5 Qns_marquee.left-=copyspeed: D# j/ s! K6 J" J7 E: m9 p8 z1 J
else
( `( h4 g. u  v9 G, q; bns_marquee.left=marqueewidth+8
0 D/ d2 b8 }/ [1 r}
/ t4 s+ r. J- r. q}% I5 a7 B7 h7 F- M9 f! g5 A

4 N$ N% y  V! A; H$ jif (iedom||document.layers){" w' a; W; Q9 I; j7 T
with (document){. }4 \+ g: c! ~  ]8 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) d& ?% K: Z! G4 Q# z0 T3 c
if (iedom){
/ k- d( z5 O1 g( P9 k$ E) |% _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 g; D  a9 }6 r3 u6 X. g( l2 v5 V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ t6 x- u2 h% x( s1 Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' `+ M9 @4 s: D4 C$ S1 iwrite('</div>')5 f, X6 a' o$ N' `  }1 M
}  P1 z. a6 o% V
else if (document.layers){
, b$ ~/ \  {( `2 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& C% W% |  u5 b+ t7 a9 {1 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ y3 Y" d5 J* h" h6 a/ o# Z  @/ c
write('</ilayer>')  n: U4 G# U8 [5 C; M; X6 I8 s
}
1 F0 B6 Z; ^$ ]% b  {- m& h, q6 _document.write('</td></table>')
1 e" V9 |# v" \9 j$ P6 E}5 _: U) C6 u7 F  F% P
}# z1 G. X/ M' P$ B9 v- n
</script>

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