返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 a! t, Y# J4 y/ ]
var marqueewidth=300
( U1 W# m' b& h: A& Z9 @  d//高度
7 u8 v/ s, i. r0 Q% x5 kvar marqueeheight=25) }; C- X/ K8 z( d  k: s
//速度(1-10)
! L* o; B4 ^+ T$ H* Jvar marqueespeed=3
0 q- d5 ~  [, ~" m6 b//背景颜色
& x$ j. e. b5 Q5 g3 V7 \) D7 zvar marqueebgcolor="#FFFFFF"
+ w+ p: K& x9 Q6 n8 M8 D' ]//是否能暂停 (0=no. 1=yes)?2 b# F& j) L. e7 v0 u2 C, {
var pauseit=1
+ B3 Q+ F/ Z6 R: C: q2 e7 w0 l- m
//修改显示内容7 b! y# Q# n. r. s% d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 i7 c% v/ B% `% I$ ~; l% r+ f

$ c. W2 c# {2 ~# C
  t, I/ r/ K' A. A! H2 |0 G& @( g. i////下面不需改变////////////* f$ V0 h( _% e: O6 @9 F/ L

; t9 i4 C6 ?" v3 `var copyspeed=marqueespeed
& k  ~) n/ T2 m1 ^0 k2 m2 Gvar pausespeed=(pauseit==0)? copyspeed: 0
8 z9 q3 x& w# D! }& i2 a6 o; v& lvar iedom=document.all||document.getElementById
5 N/ k; U* [( r8 X+ ]7 ]if (iedom)1 [- z" g7 R9 m$ d& R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ D9 f& L5 j7 \2 _. {var actualwidth=''
, K) h6 K  e+ f' n# ^4 |5 Hvar cross_marquee, ns_marquee
% Z9 F3 D8 q$ P! P" J+ H* y: X3 `% x4 ?: B" d2 \
function populate(){4 U6 i. t  m& C8 I
if (iedom){( f+ l- y  y: `0 d# A1 E, z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ L% W' C- B$ U' ncross_marquee.style.left=marqueewidth+89 E1 `1 c2 Q' d/ {
cross_marquee.innerHTML=marqueecontent/ I4 G5 P' H$ X& Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" j3 M* K, V4 y, `* p( F0 d
}
1 S/ \9 t# f* S5 @$ T4 g- Kelse if (document.layers){1 K2 k& |! h) z% n8 v+ T
ns_marquee=document.ns_marquee.document.ns_marquee2* V, A7 J) ?# f
ns_marquee.left=marqueewidth+8
! u+ ~0 y& X5 h1 k! A" W8 {ns_marquee.document.write(marqueecontent)( Q7 P- e  k  L# t" G. d: r
ns_marquee.document.close()4 r" q+ @' ^- M- T! T) e
actualwidth=ns_marquee.document.width  ~$ r' f' l4 _3 G4 T! O5 E, S" M
}
. D  U. Q, I# v7 {) h' F* mlefttime=setInterval("scrollmarquee()",20)
+ N$ L7 h6 o! A1 B( Q( j}1 }% g% Q' w9 a+ o) Y" g% ^
window.onload=populate. @7 p; S5 [! H6 N5 }4 p
( W6 g) L1 [/ ]4 p! S
function scrollmarquee(){9 J  c9 ]7 c# [
if (iedom){2 Z6 ?9 Y7 t! [  l0 B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 w2 ^2 f) c/ [: tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' ~. g6 b2 D$ C; |else
+ Q; `) J+ F& t6 |5 e5 Dcross_marquee.style.left=marqueewidth+8
( Q; `' R: X3 k: D/ `7 {5 S6 Q6 \7 g7 e. d
}9 O+ |6 }* n7 T1 ^' P
else if (document.layers){
5 n& k2 D9 P4 j& i+ Gif (ns_marquee.left>(actualwidth*(-1)+8))0 `# P( C+ W8 D1 \' u) I
ns_marquee.left-=copyspeed
: Q7 M( I, a# e2 ^8 {! H/ Celse8 V3 ?  E! X, z5 B
ns_marquee.left=marqueewidth+88 V8 H# L# v- d1 }
}  x* E. P: A4 g- a) p8 {
}
8 G- K; Q1 J3 e' d# ?/ \- l( G2 Y& D
if (iedom||document.layers){- [5 L2 D1 @8 Q$ B5 o8 k
with (document){6 s0 j9 b+ A' m! l/ W/ e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, I: U  Q# m0 i( @: Kif (iedom){; o3 m. |1 i" M! a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; x3 `$ o! [, j; d# ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! C* d; r  g, D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. R9 L! B% b: t# i2 I8 B3 Dwrite('</div>')
# U# \. ^% n7 Z& L  v}
2 W( \$ |; M- s: celse if (document.layers){
7 X( ], n. j; e" J* m, ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" U0 w* i$ p# y. H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 a$ \% R( t  w; f2 y  `+ G6 z
write('</ilayer>')
1 |4 l' O8 ^6 C" s$ T0 G( ^}, S7 F: a3 I, w/ H5 g) @! W6 |, b& e
document.write('</td></table>')
0 }! \% s, g' v! J$ ]4 O9 _}6 I) U: x; U4 Q' V( n" j
}
& b4 V; o  R; l</script>

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