返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 Z$ S7 V$ k& {
var marqueewidth=300
/ E4 f3 }+ Y0 t9 P) J$ C& W9 p//高度
7 M1 |+ p9 v( Y9 rvar marqueeheight=256 ]( a/ r0 G; H4 _! p0 n
//速度(1-10)4 [" t+ U. h/ a6 J# q
var marqueespeed=3) p7 X: ~+ f/ v, D7 Y4 _( a
//背景颜色
: ?. H9 E: H4 q) F4 nvar marqueebgcolor="#FFFFFF"
' a( |6 Q/ ~9 [+ |//是否能暂停 (0=no. 1=yes)?
, ^& P; d1 x# V2 \1 tvar pauseit=1
; \1 y5 _8 z3 _7 G- {
2 ]2 }* |7 q. R/ Y//修改显示内容
) E. X1 f7 g) fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 G5 s' v1 g8 o8 R- a1 _" l. [5 t, s2 [4 f
' B; T; i/ H! W) n1 c' g1 S
////下面不需改变////////////
( O0 G  @; j/ E/ p% N, d" |# g' l& Z7 s0 J; z" {
var copyspeed=marqueespeed
5 l9 q. Z% V: w0 C3 @var pausespeed=(pauseit==0)? copyspeed: 0- i) ?5 O3 c' t; ^
var iedom=document.all||document.getElementById
! U2 p6 U7 z$ `0 P2 N0 m! P, ~. xif (iedom). v: F4 D% m. a& i+ J; g" O: B. ]$ O0 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: V7 t0 ~# z+ p2 c( M5 I+ }var actualwidth=''
1 y4 F1 I4 j1 x& evar cross_marquee, ns_marquee
/ o& i, ~- B/ @! U2 h& B4 K
) p& _( Q! [2 ?, ^6 Q( pfunction populate(){; h" u5 D2 J. C) `
if (iedom){
: d5 I. v0 R/ ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 e! C$ a0 K! D# x% ]: v0 v, b6 p/ b, m9 ccross_marquee.style.left=marqueewidth+8
. J7 P3 J8 g- Q8 G) k8 d5 M5 Ncross_marquee.innerHTML=marqueecontent( S* b* Z* V. S' Z* r( b: r! I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; G" W0 R) ]& d% n- R& {}6 u* q# C% D/ n4 p
else if (document.layers){, @0 f+ _# d( z' Z0 @" U
ns_marquee=document.ns_marquee.document.ns_marquee2% c9 u) N9 Z& `3 a5 ?7 S
ns_marquee.left=marqueewidth+8+ J0 V0 i/ C1 z$ O! f$ b
ns_marquee.document.write(marqueecontent)
* N' P6 ?2 v) gns_marquee.document.close()
! a7 R3 j: w( t  o. i- Zactualwidth=ns_marquee.document.width
" \! x2 b  \* q  z3 ]}
7 }! |9 R$ B; T- [5 i  Jlefttime=setInterval("scrollmarquee()",20)1 L" u; k, T! k& I
}
9 s6 W+ z4 S7 B7 S; ]' Hwindow.onload=populate" _& L+ r4 S* y' D) L! ]# L0 Y4 ~3 J
: h* _+ C) R: _) ^2 ?& @  J
function scrollmarquee(){
4 C6 A# Y+ R/ V3 Y% Cif (iedom){
4 N4 T9 ]6 k& x. Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); S$ g4 R* r' C  a0 G7 ]/ D0 V& f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( \. c. Q3 \& U
else
! d( y' _% ^7 o' C# h" ?: ncross_marquee.style.left=marqueewidth+8. r1 x2 Z# G( K) h8 L* J% N7 j3 q6 D

7 n+ d5 _+ s5 g; F2 H3 [}6 F2 r* y1 ?  ?5 ^+ W9 p
else if (document.layers){" m1 A% b/ i4 m3 |0 t) Q/ ~
if (ns_marquee.left>(actualwidth*(-1)+8))0 e. g; }' w. B7 z
ns_marquee.left-=copyspeed
5 w4 S2 E$ X8 p# \& v+ l4 o- l3 b% }, Pelse9 z: i0 ^1 D0 t; c' [
ns_marquee.left=marqueewidth+8  K; r9 V" s$ \' w4 J! ?+ D5 Z* F
}
$ s0 p1 c" Q0 j5 t}- p  W+ Y( a2 m  s/ l1 v0 I, [

  L6 p4 [: q& t4 e  R* Q& w& ]* Y# Gif (iedom||document.layers){
1 M( y  Q' a4 q8 P& dwith (document){
: N( \! `! ~2 o4 p2 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) l  A* z1 r0 M5 C4 Z% j
if (iedom){
: {: @7 h' u  t% }0 z9 Y# @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 x3 M" ~2 V, g' U: R$ owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 ~, f3 A0 y* ], `' I7 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! J( f# G9 E/ ~& @
write('</div>')
9 p- H$ F' r/ G4 e}2 N: ]! c  y& T6 S6 x- O' L
else if (document.layers){
: W8 b- ~& Q( j( Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); v# J/ B9 T6 l: ?" c, Q6 J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. \* w/ N! {6 n4 \2 ]4 w6 _  Swrite('</ilayer>')
) ^9 g7 Y6 m; `6 k( h}
4 [$ h. p3 o; [' b2 n& jdocument.write('</td></table>')
, l5 m+ h$ ]  S4 K}; M( F+ R* M2 U+ X. ~) @
}% x" r# K' P  z, f" p( G& ~& l# p
</script>

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