返回列表 发帖

网页之跑马灯文字特效

//修改宽度: A4 u$ L$ O$ m" u+ M' U% W
var marqueewidth=300
/ i7 l! F* [9 t. s9 B* x) i$ I//高度
& m  y* X# G3 Q% v% P2 l+ xvar marqueeheight=25
3 ^+ F+ N$ T" D$ O2 [! B- V//速度(1-10)$ m4 f( b9 Y  q/ H& V
var marqueespeed=3
/ t& N7 c. _9 U6 }7 W: ?2 w//背景颜色$ {! V/ K- A; u) B% S/ h2 g: u
var marqueebgcolor="#FFFFFF"
! C! V7 X7 O5 o- n0 ]9 `//是否能暂停 (0=no. 1=yes)?
8 e3 X+ F0 p) F, H  e9 w4 ^3 Hvar pauseit=13 \, F3 T  Q( y: r) l; @- w+ Q
: o7 R" d! ^3 N0 ~( |! t
//修改显示内容
$ Z) ~" ?$ N  ]5 p; xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, Q' @8 F' Q! b1 V6 U" P8 N
3 C9 c7 ~: N2 s0 y: Q1 ~
. w$ o8 W: A- _////下面不需改变////////////; U6 {7 P" D% M+ p4 V8 F; d2 G
5 ~& x$ H, R6 N7 h7 i- G: ^# C! D5 w
var copyspeed=marqueespeed) O9 E. d! p( Z4 ?
var pausespeed=(pauseit==0)? copyspeed: 0* B) l# K% u5 v0 M" Y3 D/ x- G
var iedom=document.all||document.getElementById
: v# E, v( Z! E0 |: m1 L0 r& T; Uif (iedom). @% o5 i# O0 q6 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% y% D6 t8 O6 |. _var actualwidth=''
* {0 e* ?9 l8 D' A6 rvar cross_marquee, ns_marquee$ a+ f6 L3 k) A5 k8 M

- a5 b8 b; _3 `9 D% mfunction populate(){
) j! a& o" h/ T: ]0 w1 eif (iedom){$ e  X9 |0 \* G* }7 L* t4 n
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 q) W+ y" z0 X! V% N; C
cross_marquee.style.left=marqueewidth+8& \  i7 k3 u8 w; L. i) e5 Z
cross_marquee.innerHTML=marqueecontent
6 `( }- B' r" v* X4 Q! A2 X1 ^& Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& Q+ \' ~& i! f% \* S  q}
1 _3 r4 q' N$ r- u0 e4 [" w4 @7 belse if (document.layers){
- C3 b9 j' U& |$ Tns_marquee=document.ns_marquee.document.ns_marquee2
  H* ]! T  F; y/ {  I$ cns_marquee.left=marqueewidth+8/ c' Z+ k$ M# A( B
ns_marquee.document.write(marqueecontent)
6 i5 r1 r( M/ b8 K1 Wns_marquee.document.close()4 j+ ^& J/ i8 |
actualwidth=ns_marquee.document.width
4 d: y) |* O% V}6 L% a  b0 l6 m, d1 y& L& \0 t
lefttime=setInterval("scrollmarquee()",20)
# |1 U0 H. j) S# d3 T}
% B2 p6 n6 m& Uwindow.onload=populate; ]. v" R8 }' J5 l1 \" G

* J: J1 K1 P3 m5 r1 ?function scrollmarquee(){
1 z+ u4 g1 b: @. wif (iedom){
) i+ o1 p+ f7 V# o) ]% jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' T" H/ b7 s  [$ N1 b2 c) Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 e# X- w; @, Melse
; [% H+ S8 A, l' f7 ]( ~cross_marquee.style.left=marqueewidth+8
, l3 B( O% \6 A; U$ S) x) ^
/ x' j9 K; v! U( A}
/ E/ T- d( Q( P2 oelse if (document.layers){& \; S% E6 g/ j$ \) B7 W0 G# w
if (ns_marquee.left>(actualwidth*(-1)+8))
4 M" f; J) A( c& m$ N! ?ns_marquee.left-=copyspeed
; b* v$ Y9 X4 e/ |( g3 w) ]" b9 ^& Felse
, S; N' \2 [9 p- K" r! vns_marquee.left=marqueewidth+83 @2 d5 U8 L, ^3 f1 V: u' ^
}! v( @5 r& B( ^. t8 B. j2 Z
}
' [& `5 n- L6 E6 m
3 G0 X4 ^) P+ C$ Xif (iedom||document.layers){9 v7 |% M) _; K9 ]6 A' D" F9 Z
with (document){
" d8 g2 O* |2 I( N1 z+ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 Z; b3 j9 v! rif (iedom){
1 q9 B; t: w1 y8 k1 a: jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* l0 c+ r8 V' E8 r9 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 S1 j: H; ]6 `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# o& r* m: T" u5 u( y$ l& g: l& X  X& U2 r
write('</div>')
  v5 [: J4 c/ G  I4 E: M}2 n5 Z: L& A$ N2 D3 J6 ^9 X0 n" r
else if (document.layers){' N5 d" n( o- n! }; x6 q1 R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 w- h2 N9 ?/ q2 j+ Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 S2 E% Q' g3 Y3 [( B7 `' o! kwrite('</ilayer>')
% @& D* t: X  ]4 d}' ?* g! B8 y  e0 \9 n1 i' U& X
document.write('</td></table>')" k( i0 B, _4 S
}
( w3 u1 Z( O  `* [& y4 f}
. O6 H# z4 O$ s8 h</script>

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