返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) _1 X5 ?9 V/ xvar marqueewidth=300
  B  S3 `( G, C6 O//高度2 |. U. O: w6 W' T. X
var marqueeheight=25- P( g2 Y$ z8 r4 Q( x  e, g
//速度(1-10)/ d& d4 s- n4 @; N) f! @
var marqueespeed=3( @, G. p, P) p0 I! {
//背景颜色5 b+ J3 L+ {1 Z
var marqueebgcolor="#FFFFFF"
7 y3 C' H; Y+ @9 `  A& c" |: b//是否能暂停 (0=no. 1=yes)?; K8 C9 ^8 |% r
var pauseit=16 \- i% v; W' A* L( M( D# Z
5 k, d: R$ T& J3 I1 F" k1 n
//修改显示内容
/ _. o# V: U7 ~( v# Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- h3 \4 B" I1 p1 w+ V
$ R1 L. a8 ~1 o7 s

: u1 {, e/ T: d. T0 T: P  J# N7 L////下面不需改变////////////) u1 b$ N0 I9 P0 R* g" B  _
  @+ W: h' Q) C5 n) H. G- ]' L
var copyspeed=marqueespeed6 j% |) u. M  P4 v; u) R5 u+ X
var pausespeed=(pauseit==0)? copyspeed: 0
8 [# e  V7 y+ s$ o, m- E7 }% Fvar iedom=document.all||document.getElementById/ G; g, W; z( t. ~1 [
if (iedom)3 E, c, O0 b1 I, @2 v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 |' d# r5 f; x* s- L' y$ `
var actualwidth=''
4 Q, f6 R- u# I( s* z) n. Nvar cross_marquee, ns_marquee# R- V- h! p. m# ?; f
2 V- s* i4 Z/ ^3 S5 P( B+ ^# R( q
function populate(){
/ j' c; r' l- K4 aif (iedom){
: j- F; |6 X3 Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: V! O, }% L" a4 b& F$ n' P
cross_marquee.style.left=marqueewidth+8
- z0 Z  P' T4 m6 wcross_marquee.innerHTML=marqueecontent
- D/ ]8 w6 e$ A; E- ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# z$ f2 F% W- N! u7 u0 ]: Z}* {' C6 C5 J# L. v" C3 c
else if (document.layers){. |5 C  H) X: _+ i+ s- L
ns_marquee=document.ns_marquee.document.ns_marquee2
# b3 H) R3 ?% ^% Z# F6 O4 ons_marquee.left=marqueewidth+8
$ _, k, g& w/ V' X3 h- b0 S" Uns_marquee.document.write(marqueecontent)
9 _5 s5 A6 s0 P" {3 S; S3 yns_marquee.document.close()
9 r, ~0 N9 @% c2 Ractualwidth=ns_marquee.document.width* J* n) x1 U% y! N+ m! w
}
! }2 v! U1 W1 \' ~) Y' Jlefttime=setInterval("scrollmarquee()",20)
( M, e, b+ r+ P}4 F# v( Z! r; j: y- j$ A
window.onload=populate3 @/ N' G( o% m5 L/ e
$ f+ a  \. G; f7 G  i
function scrollmarquee(){1 r  n3 m+ ]2 m/ l6 X
if (iedom){+ G' u' N# J+ v" l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 h; L  Q( T! F- d# R. c* fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" k. Z5 w# t$ c6 R  Z0 v4 aelse) l' u& X7 k) }, ^% F
cross_marquee.style.left=marqueewidth+8
  ]3 T/ S3 z1 N& U4 |) W! q
9 W9 `. E. R: E$ E' [$ \$ S9 n}3 U6 {  {& P4 c; }
else if (document.layers){- N6 K' e. x- n4 |2 u" C
if (ns_marquee.left>(actualwidth*(-1)+8))
1 z2 L; }4 x5 j* M$ F; @0 h( Nns_marquee.left-=copyspeed
+ ^- f. s, t1 \2 \else/ \/ D1 m: u2 w. \) w: J2 |. I' S& L
ns_marquee.left=marqueewidth+89 B; s3 r  @( l
}
1 Z9 A+ }' z2 r$ B1 B}
5 r  q; K0 F. F
  {0 |+ J: D. T! C0 B( j* a& E- w" Bif (iedom||document.layers){  O$ `& o* m" R/ y4 W
with (document){
5 _4 j5 w9 }0 q8 n/ f+ fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! j7 r* G* O% E3 q0 n8 A$ aif (iedom){
$ I8 |: X& p+ v& x% N; x) [% Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 j: U; V: O. v$ Z) e9 M8 _! n  Qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 R- O1 Q& \" H* G  R% _- F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' f5 m) o& [( ]! H( a9 I% B
write('</div>')
1 r6 M4 j  \& S) Y}
2 s8 R# |4 _2 ]7 d! Aelse if (document.layers){" G% y9 v% Q1 O4 D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 w+ t7 Z. N9 z5 t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' s- @7 q* w0 ?& Y- ^: Iwrite('</ilayer>'). p# j7 f! I9 @' B. W% R
}
5 i0 `' b. N' L4 W2 E& B1 F( idocument.write('</td></table>')6 _  P, b% b  f. g* H0 Z
}, s) H$ C6 m! Y: m1 {: j- c* A* Z
}' @3 t9 _! f3 N5 x; o+ j
</script>

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