返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ {4 c  H" Q0 [) s
var marqueewidth=300+ W+ C& @+ w$ V2 a! j; ^$ _
//高度5 F: J6 X) g7 G& e
var marqueeheight=258 |$ I$ H" K" C, b
//速度(1-10); T% T% W% a$ l1 I6 y# U
var marqueespeed=3
, j# D8 S/ D8 t- z8 ^3 N//背景颜色& O4 k+ I' L  s* P% g4 V9 g
var marqueebgcolor="#FFFFFF"
4 q; A" f2 L4 l//是否能暂停 (0=no. 1=yes)?
' l, O% B: k( Vvar pauseit=1
  B: {9 M; m$ r, @, A. }' {; [
4 a5 Z9 s: [# ?, z//修改显示内容
6 r, Q% y; _0 A3 G' J( \- F1 s! L3 yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ }) c9 C9 g& j, ], A% s( u
& J/ [. l6 ~$ V" R- e# _& A+ ~% A% ~. k! H( }3 [+ e
////下面不需改变////////////
+ d* {  I; @2 i7 I5 _& ]/ ^( }6 e3 ^4 O# s
var copyspeed=marqueespeed
3 u; f2 c, c$ z( o- F  w$ ^var pausespeed=(pauseit==0)? copyspeed: 0
3 O% F. Z. l& D4 O' j% Fvar iedom=document.all||document.getElementById$ f  J8 q- d! K0 B1 D
if (iedom)
5 L3 X( N  T) q( N& u+ ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( @3 @- ^: V& D6 L* `0 @; evar actualwidth=''; ]6 i' B6 n7 R7 @$ p
var cross_marquee, ns_marquee
" [% _! m  n" o3 H( u9 R( `) a! t7 C8 C. ]' z* v+ z
function populate(){# z8 j7 s, ~5 ^( O% x2 p
if (iedom){. ]; S8 j# [  ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 A2 h; x/ {9 P. V' @  \cross_marquee.style.left=marqueewidth+8% P0 j6 b: Q+ I9 x5 b
cross_marquee.innerHTML=marqueecontent: l/ L. u. y1 a' T1 h& p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" C( [7 L8 h7 C* v5 Z}% J5 |5 q1 C+ S" O! q) v; \
else if (document.layers){
( V6 _6 ~+ |: ~ns_marquee=document.ns_marquee.document.ns_marquee2
( b7 _& u- k6 ~6 ?3 _ns_marquee.left=marqueewidth+84 M' o1 D' j3 v8 u
ns_marquee.document.write(marqueecontent)
( e, {  [' ?% Y+ W1 D0 c; lns_marquee.document.close()$ h4 l2 s2 U  S- F- d: e: _
actualwidth=ns_marquee.document.width
3 X5 g" x7 t* j) c6 c- L}* e2 N  _: m9 t0 g+ r; M1 s) C
lefttime=setInterval("scrollmarquee()",20)
- K! n2 o% T; L. l}
+ {% n4 `: ~9 h- G) d0 Nwindow.onload=populate
& C( \( ?6 B  q
& u* U6 h# w2 t' ?% j. ^function scrollmarquee(){
( ~5 S$ M' N' a* h- ~if (iedom){! e  D6 g" L% l2 D+ C) Y( L, C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% T9 S3 ?0 q4 c0 E8 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ }' _" M( M9 f& `0 A$ ielse
, R! v) L. g3 |cross_marquee.style.left=marqueewidth+8
! z. n# \' M/ F5 z$ |
& x. S2 w5 Z) f% d6 t, ]3 R}
" Q! |+ w3 {5 c' r+ g7 velse if (document.layers){5 `/ i  I6 g# h; w( ~
if (ns_marquee.left>(actualwidth*(-1)+8))
/ G; E0 \9 Y/ A% V1 L) jns_marquee.left-=copyspeed( ~5 Z" {; F: H( E1 U- c
else# Q, y1 L9 I) U3 `' K) D$ T- B
ns_marquee.left=marqueewidth+83 ~" v6 ?0 Z. Z- Q* v( A
}5 e& q  |1 h" K1 u; A
}
; d# G( d6 Z0 r- Y5 X& x9 l+ V( u) I
if (iedom||document.layers){
9 X( s, e+ v( t, f9 z2 z8 e! x7 x& ]with (document){$ _. e' L9 `" l! P- _( v- n3 }7 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 i9 j3 e/ j/ a, p8 C! xif (iedom){% V- ~5 @0 a3 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 d' c. W: }; w7 B4 X" h9 b7 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% {6 C$ u: r, ]# v1 z9 D) R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 k' z& v6 g3 v' Q$ W4 ~& P
write('</div>')
" c( K  ^# p6 w2 O( y}
7 H$ k& Q: W" D- ^else if (document.layers){: t# Y9 o" \5 e, R& k  ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ B5 `5 l$ u" ^0 C- u' h. z/ Y  o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 q& a7 N% ~, owrite('</ilayer>')
  j+ T5 {( V$ t# [}2 _; ^/ ^( M7 X+ w2 K( m. o
document.write('</td></table>')( R# g3 Y. H# Y( `6 ~8 \
}/ M, `2 o4 p3 E) \2 |* w) A3 @$ g) r5 ?& r
}
8 ~! L+ s5 F7 L! j3 t/ b* p  A</script>

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