返回列表 发帖

网页之跑马灯文字特效

//修改宽度% ]+ v* p# I  w' H
var marqueewidth=300
7 c6 P2 Y  o- ?  s( O  X( ^//高度7 S9 x3 X8 K4 u# H3 ]5 V
var marqueeheight=25
# g+ m$ z, |3 Y' B$ B' X3 ]//速度(1-10)
) P% n4 D  d, F: i4 |var marqueespeed=3; [0 C) B0 A& r9 l/ Z$ ]
//背景颜色) @0 y& ^+ u1 o# a5 D& F, b
var marqueebgcolor="#FFFFFF"
$ z0 Z. H  z$ I* q* y2 X* j//是否能暂停 (0=no. 1=yes)?$ E, s4 W4 Z- r
var pauseit=1
% }  L8 K; o. U* T2 b( Y+ x9 a' H6 w4 r. Z+ e1 |& A
//修改显示内容& w$ [3 T8 s$ B. C' S9 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* p9 M, ]/ L7 C' ?' e7 L
3 u# m/ E4 D+ ~% k  |2 I
+ |" y  P2 O1 U( s0 n0 c" m1 `( E
////下面不需改变////////////1 D0 O7 `4 a) Y" M  p2 r1 A; ~
8 x3 I, r+ H' h& K3 `
var copyspeed=marqueespeed
/ j! E2 A/ B' X9 h  w% O9 ~var pausespeed=(pauseit==0)? copyspeed: 0
: x* _8 D- S% a6 @3 wvar iedom=document.all||document.getElementById  {% s% ~0 D: K& q8 O- s% g
if (iedom)
2 O' G+ I% J3 l& pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& ?4 i( {( Q5 p0 Zvar actualwidth=''; N* E4 `& T- J6 [8 \& x
var cross_marquee, ns_marquee/ u0 H& p( Y* S  V! {) u& F% R0 x
+ x8 e% Z; M4 M9 P& o& K: C1 P
function populate(){
' Q. n! h3 A% w- `5 V* e3 lif (iedom){
4 B8 c+ O+ Q2 [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" l0 D' ?; M- T. R; y
cross_marquee.style.left=marqueewidth+8
# [* F" o1 G7 q9 t, f9 A/ }) mcross_marquee.innerHTML=marqueecontent
. {2 n6 {1 |/ r' C3 q- g# T/ y( R1 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: R. h: \2 q% }% B7 r
}
0 W8 R/ G. G" a8 X. oelse if (document.layers){3 Q4 u( Z- D4 m
ns_marquee=document.ns_marquee.document.ns_marquee2
: u# s( m; q) K0 N. R" u* l+ l! I& }ns_marquee.left=marqueewidth+8+ g$ }4 a$ O: Z7 d  o
ns_marquee.document.write(marqueecontent)% c' y+ v. [; H% Z- ]0 p. z5 I) I
ns_marquee.document.close()
2 `1 T$ ]# z, ~0 h+ i* c" bactualwidth=ns_marquee.document.width9 m5 `' y3 g' g: e
}
; a" B" c! l8 [5 n9 G& ^lefttime=setInterval("scrollmarquee()",20)
9 q# `( M$ U6 P9 o! G7 B}
  G  `$ r  C  m+ {9 z& H* h! bwindow.onload=populate
: f% n( j$ h8 J- J8 |0 H1 v, B. r5 `# `& R
function scrollmarquee(){
/ Z+ d" K2 E; x; }2 Fif (iedom){
2 r- u0 a" Z# z" b4 vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' Z& f( @$ d/ V- b. I8 d7 J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 R$ E& C' H8 b! F2 U+ [3 ^else
) t' A9 v: |  ^: {- Rcross_marquee.style.left=marqueewidth+8/ Q7 s' c  p, y, g5 D3 K
1 a5 _" {+ \. p  z8 h6 k
}
7 P6 T2 U& R3 t$ Y' V4 Melse if (document.layers){5 ^& j0 h! Z# s
if (ns_marquee.left>(actualwidth*(-1)+8))
' G3 {: D  G6 V) P/ m' Y7 ^ns_marquee.left-=copyspeed
. J% N& T# b" d, |  Relse
) {( l( q$ j2 b) W7 M! Ens_marquee.left=marqueewidth+86 M' k5 n; d5 _
}
* A+ k6 A+ f4 g" M0 Q( X) w}. d2 A& p0 y* A* n2 Z

& y# I6 ]6 o$ {; R- @if (iedom||document.layers){* L8 F2 P. z$ t: p# q0 w- m
with (document){/ W4 ~$ U0 R$ T9 L* i6 {0 X6 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! B: a3 e, e6 V
if (iedom){2 Z8 |+ X1 ]. G! m2 T3 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 r) u: Q4 p$ t/ Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 ^& Y. n- V( ]( V9 _" ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ c9 S2 W0 `% O/ Q) Q7 hwrite('</div>')
9 Z$ m& b1 w' `% @' j( i}, N  Y5 _% d) N. O2 k3 B' E
else if (document.layers){
9 b5 h/ j2 w6 U+ S$ H: @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 ?: t7 [% D; t7 H$ _  i  ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 h9 c. w1 Y0 G2 I& Q2 V: H7 k5 Vwrite('</ilayer>')
2 D8 M6 w5 \( H0 t  _" x8 L}3 Q. h$ M' }4 j7 s( k5 p8 b
document.write('</td></table>')6 i2 C3 {% G- F7 E/ [
}
* @8 D  ^7 A% x6 q/ `% X. `}  X2 U. t* L+ W- t3 }
</script>

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