返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) F3 A* L. T6 @0 c* J/ \5 wvar marqueewidth=3001 o5 ~" T- B* d: F4 Y& h8 v# |
//高度9 x7 m% ?3 @# \5 W4 y# ]1 A9 O
var marqueeheight=25
% `$ f/ V4 b! f//速度(1-10)9 I3 V' L" m7 k5 s& b
var marqueespeed=3
" u" K* L( j- m( s% z( e! v//背景颜色$ J0 q1 m6 b4 Z6 \! h3 @+ Y1 o" C
var marqueebgcolor="#FFFFFF"& B- f( P. S6 Y, |9 y* e9 a6 ]( s
//是否能暂停 (0=no. 1=yes)?! m/ q7 _& }" [) h7 q( X4 D
var pauseit=1
* ~, b  o" \( T2 n& y" Q5 I' Y( @0 Y' N- B* P
//修改显示内容
3 J- @% i4 P1 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; }. N/ l$ R3 R' r0 a2 W

2 [; F' N/ W& Y( w/ S0 Q; C" W% c$ M. `% V* s4 u
////下面不需改变////////////
& t6 V$ ?- G) y6 O; m4 L+ S/ u- D9 `) b
var copyspeed=marqueespeed7 r: J1 C$ W8 T# ?+ F+ V$ R! A
var pausespeed=(pauseit==0)? copyspeed: 0
0 O1 p+ n- p7 Z& _/ y* Nvar iedom=document.all||document.getElementById
. m* F2 ]7 X  G3 \1 kif (iedom)7 p0 B$ r/ T6 w& [# d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 E' F5 o' |/ f; d7 i) P3 R7 qvar actualwidth=''
* N+ V1 O3 {- G+ E  vvar cross_marquee, ns_marquee7 H4 G$ X* B  `, }& M3 q8 J
, y' z4 f+ K' t8 k, n8 y! R6 o) W
function populate(){) J! E/ B( y, t/ @9 u- _
if (iedom){" E: @# g  h5 N  }% |* v, y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 H% S" c- ]% h1 t6 g8 `9 Icross_marquee.style.left=marqueewidth+8/ t' }! _, s( j+ n( f
cross_marquee.innerHTML=marqueecontent; e. ]+ j- P0 P6 E6 L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 n- Q7 B+ w# I
}3 E- ^; c% D6 t0 c# X) P
else if (document.layers){
' U% h4 S5 Q/ |& S9 hns_marquee=document.ns_marquee.document.ns_marquee26 z' ]- z+ t) b' G- O
ns_marquee.left=marqueewidth+8
8 d9 N2 g. D0 Yns_marquee.document.write(marqueecontent)
6 g$ k$ f8 k3 j! H2 ons_marquee.document.close()1 v1 k- B- A5 @2 D0 f2 y1 ^
actualwidth=ns_marquee.document.width
; R% [% _6 C' \! s; I4 x}1 U6 H7 n1 n9 f3 P9 J4 Z' `
lefttime=setInterval("scrollmarquee()",20)0 J7 X6 O$ x  t# [3 N. O
}2 F% D6 g; u; |0 I& j. ?
window.onload=populate. k$ t4 F  f) `3 ~5 j

6 v+ P  K" U' U3 nfunction scrollmarquee(){" n  J) x) e5 I- ^: [+ A4 a0 m  D
if (iedom){# Z* @7 D7 O/ Y* Z7 y4 e* R( R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 g/ P7 g: S3 W3 E+ k4 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; E- Z( K# E& p/ I2 c: Nelse- r8 B0 j  b, w
cross_marquee.style.left=marqueewidth+8$ }) n8 m6 ?5 X2 N( d0 M

, U1 Z* `! a4 g5 d4 M9 h! A}
" i% r1 S8 R9 R0 c, t1 oelse if (document.layers){
0 Y9 r5 m% J4 Zif (ns_marquee.left>(actualwidth*(-1)+8))
  i/ k, }1 r' d) T5 w+ I' }ns_marquee.left-=copyspeed3 ?. M9 w% o. t7 ], j
else6 y  Q6 w3 g0 k7 ]
ns_marquee.left=marqueewidth+8
+ W( R; P6 e* E; @% |; ^}
$ L, q& p" Q( }. a}/ I4 w) c& L- T3 Z

. ~7 [& E7 z1 w+ z: Xif (iedom||document.layers){+ I" X* V  w$ W2 X
with (document){
; _% K4 q) O+ ^2 ]6 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) G! }) o1 q% v/ c6 A
if (iedom){
  F' a3 x4 |- m. l* \8 `, m) V  swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 T$ N1 T0 }0 ]6 Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 i( \' Q* Z1 k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 G3 e; Y# _5 J$ \) V
write('</div>')
. n, r8 G9 Q& ?5 a' O9 B' h}9 N5 ?  L: a; N- }3 v
else if (document.layers){) V# a. U# S7 U2 [+ ]% T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- R4 l4 h8 x" z6 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- {' g5 ^. j. H( f3 N! c8 x' A
write('</ilayer>')3 x! ~* d1 T; \$ p' h
}& b! _0 t* C. V/ i7 ^
document.write('</td></table>')
7 B8 z- T  x4 Z; S  w}0 D  @: J. X8 z$ j4 l% c
}# ~+ e& @7 H4 p4 e
</script>

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