返回列表 发帖

网页之跑马灯文字特效

//修改宽度) d3 _! |* A+ [5 w* {) s7 D% y
var marqueewidth=300) S2 _0 }. Y  k0 R
//高度% j$ W# G5 O/ u( i* k
var marqueeheight=25/ q- J. A9 h2 b# V. ^  k
//速度(1-10)1 I, {0 Z8 |* B
var marqueespeed=35 b0 e  y: y2 ~' K
//背景颜色# p  \0 K. F3 N2 Q' [2 ~  u( M( ?
var marqueebgcolor="#FFFFFF"
" [# v3 _0 [; K9 Y6 M7 A//是否能暂停 (0=no. 1=yes)?
! B  [/ C: u; x6 ~var pauseit=1
1 c( l6 y# E( ?  ?5 O/ Q. P% m( A% _& z1 d% B1 E9 Z
//修改显示内容, l) h& J7 h8 r0 x& m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 n( h- s* E4 _

6 M% u+ ]  n- o* V) M
: F" g) Q9 ?  c////下面不需改变////////////+ N( |: m$ _% }- W1 q8 h

! h$ _' X  ?3 Y# w# C1 O9 Xvar copyspeed=marqueespeed
. x, a! |; w5 K8 n: c- cvar pausespeed=(pauseit==0)? copyspeed: 0
# r+ K6 \) M+ {var iedom=document.all||document.getElementById
* ]2 p, H  ~2 r* X* Yif (iedom)
! F1 ?# K* n6 G' N7 A. g( r, Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 U( \6 v% F& M
var actualwidth=''- B& X+ d: V* P0 O7 M
var cross_marquee, ns_marquee/ F0 L$ F. z( ?

/ Y  u% l8 m9 M  ?! E0 Efunction populate(){
' c* b# E5 t" _9 l/ q  Cif (iedom){
' w# c$ [5 y, z, M9 _2 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 J7 U9 R' V" |# d, ?; xcross_marquee.style.left=marqueewidth+88 b' c- K% R1 t, Z: v8 F
cross_marquee.innerHTML=marqueecontent
& ?( G+ k/ ~( v; P7 }( `$ zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) X4 a# f$ c) W' S8 v4 _! U}4 [. x5 T2 V  \( U3 V. w; y  @, J
else if (document.layers){( s9 f0 {2 Z8 p) X  O% a% ^
ns_marquee=document.ns_marquee.document.ns_marquee2
+ R* v+ r# q( H8 p/ b* ~" T% e$ a* Sns_marquee.left=marqueewidth+8
' `9 J7 S0 S9 n/ |ns_marquee.document.write(marqueecontent)
. U) z/ y; t2 Tns_marquee.document.close()
! J( n. t6 G6 gactualwidth=ns_marquee.document.width; f' l4 L6 G4 F6 a
}
, T: }; ^6 A5 ?( Dlefttime=setInterval("scrollmarquee()",20)% m1 a; S& e. y2 N6 R8 `: U
}5 B9 I: M- l" F% \6 w& {
window.onload=populate
% g0 @% W8 e6 T5 u- n& l3 p9 K/ W: C/ C  L
function scrollmarquee(){4 J0 g$ C9 A9 K4 O" s0 K
if (iedom){6 T0 x  [+ U" N9 b. }; M% Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& b, T- ]& |' L( M  K3 ?: Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 k# z6 m# t5 g* M; s
else, \; ?, V1 u0 x, p) m0 p
cross_marquee.style.left=marqueewidth+81 R( D8 N: B: ~" I# i7 H

  ^0 C* w' }8 y- u}1 `9 a2 t9 v5 _1 j! w8 b+ \
else if (document.layers){0 _) p) j% e. j4 U0 P
if (ns_marquee.left>(actualwidth*(-1)+8))+ B! [3 |/ Z3 p
ns_marquee.left-=copyspeed3 k# C' p$ O6 T. X
else
0 U  x1 m* D, r5 v' v( a$ V9 {- [ns_marquee.left=marqueewidth+8
  ^" ~2 U3 I# J1 r4 {1 n$ t}% D1 D8 w, y1 a5 S4 |6 m+ w
}8 G, X. O/ ?0 F, H7 x0 S$ X, X
/ r/ [3 i1 v0 w
if (iedom||document.layers){0 v  C- U* w( S0 Q# @$ s+ U
with (document){8 \' Z4 l* s# u+ p! Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 t0 F& a) ?' v# o) E/ Dif (iedom){
( r9 L+ c3 j) v  q* M) Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 x! c% w$ z0 h' C1 U1 [
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): f% G- ?1 W3 o) Z7 s9 r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! \9 W' t- D0 O' g% q# Y3 j- Vwrite('</div>')8 t# H; \6 u- l* C2 D8 _
}" P2 O7 C1 k- X9 Y
else if (document.layers){8 I" N. H0 v. o; W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# L/ L) ^, f. Q! a3 D" c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 O3 q: m+ ~4 jwrite('</ilayer>')! s8 v, J: R: P" B9 M
}( }8 C2 q! W2 p' g
document.write('</td></table>')
; K/ O5 }1 N9 y+ N3 x  Y$ q7 L}
8 i8 h& J5 V2 X1 Z}
. Z7 s$ W, n. K( l( l6 a: P</script>

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