返回列表 发帖

网页之跑马灯文字特效

//修改宽度) Q3 b( D0 I# n6 r
var marqueewidth=300) ~& w, g6 K0 I
//高度
2 m1 h0 X' E" f4 n. uvar marqueeheight=256 M. n8 Y  |% D/ F  M
//速度(1-10)
' h5 k% G  M0 V4 Dvar marqueespeed=3
  W' S: w; o& k//背景颜色9 t: \! @. B! k- ]
var marqueebgcolor="#FFFFFF"
" d0 L( i% c6 b# r: M+ s//是否能暂停 (0=no. 1=yes)?6 t. R" A* n! h* Q/ @
var pauseit=1" l4 w. M6 m: u0 {0 j& K9 P, |
5 n; S; p" X  X2 Z: L
//修改显示内容2 m8 g: B, z1 D3 C. j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) A. ^8 D, z$ G5 d. }& b( m* I) J, S
9 u- f% Q# n$ m  K2 C
////下面不需改变////////////
+ [, Z5 ^6 m  `6 K8 ~+ g' r+ ^& l' |7 r9 ?! I& u
var copyspeed=marqueespeed
3 p* U( d3 Y( d  Z: z* K) l/ svar pausespeed=(pauseit==0)? copyspeed: 0$ b0 h5 v# j: B
var iedom=document.all||document.getElementById' j% f( l5 n3 Y6 `1 I% |' }
if (iedom)
9 L, Y6 I8 c+ G# [7 D' Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ u. n0 Q9 {2 {$ r* u4 M$ @' a, ^
var actualwidth=''
6 n% _6 i  K6 Q. x7 [, J% ]var cross_marquee, ns_marquee
7 O3 C' L) s8 o
9 V/ M% k6 M6 \; L' `3 sfunction populate(){
+ y* g4 e4 X0 c$ V7 }. @# \if (iedom){1 @* M8 ^3 u8 a8 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 \& J% R2 [/ s6 t5 F; ^
cross_marquee.style.left=marqueewidth+8
; V1 |" v/ u) W) ~cross_marquee.innerHTML=marqueecontent. Y3 `# L$ n% `' E% M) ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 u1 q- T% R- x+ P
}( X1 c, s5 S  n3 P* e7 O$ m7 |
else if (document.layers){
9 s  p9 p% n1 ~; O8 H$ y+ I* ]7 Lns_marquee=document.ns_marquee.document.ns_marquee2
" j* y+ [* z2 w% M* nns_marquee.left=marqueewidth+8  R+ K+ S2 A- P. R! v( c3 e
ns_marquee.document.write(marqueecontent)! S3 V* D# i0 x8 m
ns_marquee.document.close()
; E9 N, g5 b9 Q, Y2 U5 x, wactualwidth=ns_marquee.document.width
* C: j! `, Y; M9 N}
% w* k7 N; F( m) U0 b3 J# glefttime=setInterval("scrollmarquee()",20)
2 \  q2 z1 U- F2 _' i, f. N}
; v0 i' U; `7 J- Q' twindow.onload=populate. I' D4 h% G) Z6 m, h$ F+ \' \( O
0 M; b& T2 L2 P9 x3 _& ^
function scrollmarquee(){4 \  c5 H+ a& z; M+ }0 H
if (iedom){8 w8 w7 t' z/ t  I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( L& P( }, T2 ~" mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 C9 b. o, a% V$ H, ]& S
else
4 T' W2 n0 t4 q- \1 k# G! K, g1 V' Scross_marquee.style.left=marqueewidth+8
8 A3 `" z+ |1 \1 B$ h  i& @8 n3 Z' w0 l- J' c. p3 K) I
}: D4 M* r2 E  b" N& c1 i, x  w
else if (document.layers){$ F! a' m# I) b. I) T8 V; [
if (ns_marquee.left>(actualwidth*(-1)+8))8 L+ p; p) d4 }. f
ns_marquee.left-=copyspeed
! r- e* U% o+ ~  O. }9 velse" a# Y/ N9 @4 u0 m. J3 L8 {1 n
ns_marquee.left=marqueewidth+8
# n' G0 E! T: ]& m1 g$ V}
* L3 B5 R* ]7 @' Z9 D}
# i; W8 p: T9 ^8 f5 [7 l, u: F* f5 p
if (iedom||document.layers){5 v/ D8 r) Q7 ]! a) w. L) Z3 X/ a
with (document){) ^6 X* j- C; n5 T+ v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ M" ~+ Q$ E( `) Q! G* A; K. W: Aif (iedom){; G" a" @& ?) p/ o1 y% T$ U4 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( N$ u$ ~( m8 n; b$ G# [* E$ a. Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 p( |0 S8 Y, |6 }3 T; wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  f2 }) _  R: B8 R7 P7 Ywrite('</div>'). y) m  F. \3 s' R6 M
}
' l+ u1 r# N" _* h  C7 Yelse if (document.layers){& }( o/ f" {, C- u2 }* V( n# \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ Z* O# M" J% J8 ]2 h; cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& n/ @1 T  M* s3 i  Z8 e9 cwrite('</ilayer>')5 t+ R" C, V) N* i
}
! |3 z% U7 L- x5 _5 k; t$ ^document.write('</td></table>')/ ]/ l9 j. b1 q9 B& n& j( C
}) ~3 @' B$ t1 C6 c& Q
}
: q+ I1 j, U) E' R, q" l</script>

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