返回列表 发帖

网页之跑马灯文字特效

//修改宽度' R- p" X* Q) K" y7 w
var marqueewidth=300
9 p4 w& s- l: C8 Q* Z2 L' t6 a  Z//高度
3 H) N$ X7 _4 h- j, K4 rvar marqueeheight=25
- o) h! L2 S- F- t) K. a0 E5 b//速度(1-10)
$ F+ l% t- N; L1 O9 K6 `var marqueespeed=36 ?& S- I( L, [& ^
//背景颜色
$ q! B  f' R( F4 ~var marqueebgcolor="#FFFFFF"
2 i4 u$ N, h8 J9 g//是否能暂停 (0=no. 1=yes)?2 s" Y/ F2 a/ S! w' a5 B
var pauseit=1
% G; A7 ~, M6 u0 a
  h( H) u8 A. f4 o& A* ^//修改显示内容& F3 U# A; d  }* h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ j, @8 g; H3 x/ ?
9 x: s2 z4 y0 [
) D& }9 W$ X6 Y4 g. k
////下面不需改变////////////9 p" {: w" ]# \2 v* J. M

. |0 U* O8 B; |  p# Avar copyspeed=marqueespeed& E. K% c1 b4 L; C# d" `1 c( [
var pausespeed=(pauseit==0)? copyspeed: 0
* {) h6 b- \, lvar iedom=document.all||document.getElementById: m* P4 f. ~2 v7 {
if (iedom)
$ e1 T, s# T  w; H2 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 ?9 T8 Q% g, l3 l* H1 tvar actualwidth=''* m9 x  r# Z8 K9 R/ Q
var cross_marquee, ns_marquee
1 |1 A  B; g; ~. f  @3 T0 _5 \
0 V4 O- ?: \, B0 ?7 {9 u8 K- [function populate(){2 {9 V: b( g2 r' v
if (iedom){! e/ I2 _( f" {) B/ }5 h# ]9 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 [) D2 @: {! d9 y' x3 Scross_marquee.style.left=marqueewidth+8- X7 ^7 g- z! k1 Q% _0 r% M
cross_marquee.innerHTML=marqueecontent
1 H$ Z% p6 q6 w. g) \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ g* F- \# P$ o
}
5 z: b/ H* T( K4 Belse if (document.layers){
) z% O4 t, `7 j5 ?7 }6 @ns_marquee=document.ns_marquee.document.ns_marquee2
  R6 k- a5 ~0 x0 V4 e# w, @ns_marquee.left=marqueewidth+8
  c& L# \  ^  U- o) X& C# w+ Z( Jns_marquee.document.write(marqueecontent)
: f; ]( B9 U* S1 B6 u& e4 {6 ens_marquee.document.close(), s) ?: r$ q2 _" u1 d( s) [7 {
actualwidth=ns_marquee.document.width
" y1 ?/ E: R! X4 J1 T& g' ?5 l}
/ |2 v7 u0 H/ v" Q& _lefttime=setInterval("scrollmarquee()",20)
: c; H* |( F8 [; s0 w}
3 ]. q2 A2 x, ^/ \' B" rwindow.onload=populate
  a5 Z+ u5 y; u7 K2 n6 x- f  A1 O+ c/ g' E# Z4 G  u
function scrollmarquee(){
) H1 B( w+ ^% a- Q" Jif (iedom){
- o9 |/ }+ C, wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ t4 F. d! N2 U1 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 S9 \  m: N  O! l2 A5 H$ ?2 K) z! |  belse" P2 y5 T! x% K
cross_marquee.style.left=marqueewidth+8
# D2 }1 h2 q8 d) ?
# o/ j0 r& |1 v6 b}, L2 k$ I8 N" c8 t- r1 W2 i0 P4 v
else if (document.layers){; o* u. m, C' G+ N* y) _( A8 P0 [* t1 p
if (ns_marquee.left>(actualwidth*(-1)+8))6 W- \3 p- k! d
ns_marquee.left-=copyspeed
: m6 p% f6 z$ p/ e& U9 m6 j0 felse
' a' M2 ~4 }/ g3 j  Uns_marquee.left=marqueewidth+8* Z: f" [$ q+ Z% p% `
}+ g& T0 X, Y$ X
}
7 ?1 f" H2 ^/ e: P# t2 E) h- F8 n: @8 u8 T  V0 D
if (iedom||document.layers){. i8 Q3 @7 a% S0 G+ y
with (document){
5 i" \* B3 o) I& d+ I. e! Y9 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), Q- s0 M/ n1 k1 _4 T1 \0 u1 M
if (iedom){
9 M1 R" C1 K4 w) Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ [3 s2 x& i* G2 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 n9 E% U, H1 Z' P: k4 T- Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). t5 Z" L* \# e
write('</div>')0 F  B+ f) r" P0 X8 d+ k1 [. u+ C
}
, i5 J2 P1 j2 d/ uelse if (document.layers){. \- ~! e6 E, j! a  W- ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ _+ U4 J" W% [& b! y# i+ wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 l3 r! w& t/ \. C$ l5 q/ @- O( cwrite('</ilayer>')
/ {0 v, {" y2 Z5 {}; R, x/ J/ ~/ w; Q: |6 }
document.write('</td></table>')7 P8 d: y1 q- n8 n! E8 B$ U& g$ ^
}( U4 A" Z) z. c7 S; ~
}" b3 e* a. P: C( l4 C# v1 p
</script>

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