返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 N2 r+ O3 {  |% u/ a; G% |* i
var marqueewidth=3006 U: c( }: `4 c5 u0 q- ?
//高度
) @$ h% @- O1 }3 a- \var marqueeheight=25, U6 X" j. H/ n/ j. P6 a# u
//速度(1-10)" T& v% ^+ j% k/ I; w
var marqueespeed=3
6 T( O5 j0 t6 F3 r8 m//背景颜色
) j% D# m/ k1 T$ Z2 R# Mvar marqueebgcolor="#FFFFFF"  u  h* d% A' E+ J9 s
//是否能暂停 (0=no. 1=yes)?
( `- M" [7 B  R9 C% Svar pauseit=1
. q& _* `5 i% W/ j2 ~' {& ]: k% @* \
//修改显示内容0 {# Z( T, U6 d& Z* X2 f8 Q* X* S* l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# e0 q6 P* y* q, a5 _' c. p' @

7 ?0 M6 B6 t! `6 \, z: {% R8 q! x; Z1 T$ `* `. T
////下面不需改变////////////
: J3 |3 o6 M+ W: `5 L; e8 l5 X$ d# k% m8 O6 c
var copyspeed=marqueespeed( \2 t9 z( M0 q/ d
var pausespeed=(pauseit==0)? copyspeed: 0
' S- c. H' U; g+ B# T! f: ovar iedom=document.all||document.getElementById8 M9 V  e: m5 R" w2 u3 Y; j4 O; w
if (iedom)
0 a' ~5 ]* e$ k% b# l) qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
  k, T. x9 w8 A+ N6 Z; ~, gvar actualwidth=''
; D3 i; M0 m, u: K4 ?/ wvar cross_marquee, ns_marquee
" O; D7 k6 Y/ F2 p" o" H
  ?" Y' W. s3 L6 V6 nfunction populate(){
* s2 P' |' ^# N7 o4 R2 f7 Vif (iedom){1 B/ c9 v4 ^4 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" I) M3 E# U7 K: u7 S/ I% R- s
cross_marquee.style.left=marqueewidth+8: ~) V- N/ X9 I: y# z8 L% R; ?8 B
cross_marquee.innerHTML=marqueecontent
: Q" J, z' l3 t9 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) l% h) Y9 I1 d$ s0 ?}( o; `, R/ h0 g6 a2 o; k9 L$ ~# O8 j. B; K
else if (document.layers){. K  q) _6 K# k9 h5 T/ l
ns_marquee=document.ns_marquee.document.ns_marquee2/ B- i  B9 C! r* c! C* r7 P- W
ns_marquee.left=marqueewidth+8
) C; l. j/ m; Z! Z# Pns_marquee.document.write(marqueecontent)2 ]/ I/ [/ k. V- _
ns_marquee.document.close()! ~4 _' s" o- E3 H
actualwidth=ns_marquee.document.width
; d8 O9 J$ v7 I}
6 J8 m& s4 [5 Y0 o9 A. D: ulefttime=setInterval("scrollmarquee()",20)9 y5 {5 N* _6 O7 G4 {
}
4 X- t% Q! h3 k: I( wwindow.onload=populate
- }4 {& O) f3 k9 y
) x; l' Q5 j# k+ U! u, r7 x5 Hfunction scrollmarquee(){
3 P) N6 O+ B) _+ j' Bif (iedom){
0 r& |$ m/ f& C5 Y1 w7 Y; p- |  Oif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 P  B5 g0 @' |* C: K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ k3 k7 R0 {- T0 k3 l( h' A- j- L: d
else% g/ r, t  P( Z* o4 a6 _/ U: D
cross_marquee.style.left=marqueewidth+89 i# O  U' R9 t9 O  X8 Z6 V
7 w  b2 F3 d1 s+ s2 f, G8 c
}, x- n- Q" x1 x/ M: Q
else if (document.layers){+ ]8 M5 y4 @  }
if (ns_marquee.left>(actualwidth*(-1)+8))
5 E/ k! s2 P* j4 Wns_marquee.left-=copyspeed3 V  m9 V- V7 f
else
8 s, J' [! I8 Ons_marquee.left=marqueewidth+8
; V. M  V# {$ V5 l5 z/ S* k}: v% d8 k% I% r& N) K4 p
}8 r" i5 C& z* j7 w4 n7 h5 D

, O, P+ [8 j5 a/ {- |9 |$ r- ?if (iedom||document.layers){
& g- }: |; Z8 J. a8 H- cwith (document){* o: k$ m+ K0 S4 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ l8 `4 W- B" dif (iedom){
+ d/ @9 ~( B/ {2 \4 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): h/ `& o& [/ k; ^+ ]# j+ ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 o# H( e' T; n' ]9 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); Z0 M! w( ]5 }4 k' A3 ]. D* H
write('</div>')
+ w, r9 {# }9 ]+ q# {}
$ R2 B" u+ a1 E# l- uelse if (document.layers){3 G4 ^6 Z& X& `
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. ?: J- t* I% e5 owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ U8 e' q7 ^4 W6 ^& b3 _! N; C
write('</ilayer>'), s& b. i/ j# B4 r8 ?/ e# ]
}
* Y& l+ O$ B( I5 K8 {document.write('</td></table>')7 h2 m' [- i( F9 Z5 ^) I; `% v
}6 S2 Z1 Q+ o  |% P7 e7 ]
}
1 W) ]5 Q1 G+ P  f+ E</script>

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