返回列表 发帖

网页之跑马灯文字特效

//修改宽度! @$ P3 ~4 _+ d% }' h% T
var marqueewidth=300+ p! x# ^1 |) i$ C' v! ]* l
//高度
! _0 p' A( `0 }- N+ o+ Xvar marqueeheight=254 V% Z3 u0 {  t' K9 W
//速度(1-10)
: f! n; v& q. d8 y- v) a. Vvar marqueespeed=3
/ m& M, }% H3 @3 f5 H# K  \6 X( H//背景颜色, ]$ W& z0 R$ D! p
var marqueebgcolor="#FFFFFF"
" T! J, h- `- `+ K- F9 N//是否能暂停 (0=no. 1=yes)?' M+ T% Q/ y$ B9 V4 x! r5 Q$ k
var pauseit=1# h0 V! H  b2 o) p) B9 ^: j2 K
  q( o) G3 ~/ Z+ k% P: `" X
//修改显示内容2 l9 U- X7 r8 l# R6 E5 t# f# L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# F0 I/ ?6 C/ _6 R0 S

! Y5 S6 |. F8 a  l: k$ B( Z$ Z( U, n
////下面不需改变////////////
" A* a; s$ ^# y) Y( T; |+ B# m: F# K2 \6 ?6 P3 M
var copyspeed=marqueespeed: h1 R* D8 D; s0 i
var pausespeed=(pauseit==0)? copyspeed: 0% H/ }& w. D+ r9 l( ^
var iedom=document.all||document.getElementById' a3 U, H2 O' v! [: n
if (iedom)( q+ r4 M, e! ]  z  _1 t" r3 ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 w  f4 R- D! T; E- pvar actualwidth='': f  P  L5 B  `/ I
var cross_marquee, ns_marquee
, ~2 [% [/ w6 l7 H4 l
! k$ }" [8 P, g2 T4 M, Ofunction populate(){
; `: z) F2 @" a+ oif (iedom){6 L- K! m$ j# u$ s) Y2 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( L$ }$ B: w1 {3 e* o% h% q& F
cross_marquee.style.left=marqueewidth+8
- Z# t% U. o* d2 C% ~1 [cross_marquee.innerHTML=marqueecontent+ ?6 x) x& V; U: }4 W; t
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  `+ `9 s2 c  m" G  O4 ~}
0 j5 S$ B# Q* Nelse if (document.layers){
1 k) Z  e/ c4 K: ]' _% S- ?* Xns_marquee=document.ns_marquee.document.ns_marquee2" s% K! V" M: Z0 Y! C7 t. e* A
ns_marquee.left=marqueewidth+8- j5 G- w  S* ~( F4 ?
ns_marquee.document.write(marqueecontent)
* s! h0 [' g% B0 `* Yns_marquee.document.close()* ?  H' t' w4 f8 ]* ^* W% |
actualwidth=ns_marquee.document.width
' v7 `! v+ C3 }& Z! q: S}
" u! T) Y$ ]+ _7 l6 {- P! s' n, vlefttime=setInterval("scrollmarquee()",20)
0 [  ^: q, h3 D' U}
8 J! i4 C+ H4 P4 u) }window.onload=populate2 j7 q3 e# F+ x* L, h9 h

# e4 s1 N! ]/ `/ \, \function scrollmarquee(){8 j/ B) G) N, b
if (iedom){+ q. o+ S2 p& o+ i6 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 u  o# S/ n7 v% B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 q6 Z! ~5 c  W; _. ^$ x
else
* k% r( Z  z9 N5 O. q) Bcross_marquee.style.left=marqueewidth+8
& b6 v7 E" y% F6 n. t4 i2 l, R4 \
}+ B- H: k; I6 f  [4 m: [! A
else if (document.layers){9 @6 K4 P% Q: m7 Y' a( P
if (ns_marquee.left>(actualwidth*(-1)+8))# Z. ^# Q6 \6 V/ I7 o9 ~
ns_marquee.left-=copyspeed+ p) L; U: t# _3 K. c
else7 ^/ _6 [8 x' p0 [# ~
ns_marquee.left=marqueewidth+8
8 k$ T$ w: }2 p' b}
* h% Y/ V1 M4 r0 J0 Q7 O# l" Q}& f2 c8 P5 z- v# B! a
$ X0 G2 u/ N; l( d- M
if (iedom||document.layers){
% d3 a  U, j' W3 a  x" Rwith (document){
# u- c1 h" M; }0 Q4 {" \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& M* A. t/ H- D, fif (iedom){
) Y6 V& v# Q& t# n8 lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; }* i4 C  [% m' Y) F+ Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 g, v) X( U6 v, h2 q! S  Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ H) x( y! g6 S! _7 r8 Fwrite('</div>')
# Z( }& }1 F" B2 `}
# j6 @% \- s* j4 f/ \5 P! eelse if (document.layers){
; m! x/ C( m+ a" S% cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 w7 k# W" k. h; c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) C! Q* G, ?% p7 W9 B
write('</ilayer>')- A2 h  F+ G4 x7 W) `2 Z
}0 e& K- D/ k& k/ ~, O% f! f
document.write('</td></table>')
* F8 X- r3 @, A0 h}! N8 B/ z9 }. S! M! D- a
}7 C6 e2 E; K* ?* R( C8 A. g
</script>

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