返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  z( H0 e- x! x" B* P. ?# Lvar marqueewidth=300
  j, R; O  D/ [//高度0 F8 a- g$ N+ k# z$ i
var marqueeheight=25
3 @4 Q# F8 G, m1 m//速度(1-10)
$ P; {/ |' @' E2 Q; g! U) A! lvar marqueespeed=3
; u/ o! g/ f; `+ ~- H//背景颜色
- z$ j7 N/ ?! ?, P6 j8 p8 X3 Hvar marqueebgcolor="#FFFFFF"
0 e& c7 y  L$ }- [1 R# W//是否能暂停 (0=no. 1=yes)?
# B( J. K6 f/ R- `! a: E, u2 |var pauseit=1
4 N, N; I: g. p  r+ @
8 _  d! a8 f8 I$ R//修改显示内容
+ O, P4 h* B' [. y- Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' z' x: R+ z1 m( F; O' J
" n' Y6 I" q" i, \! y3 v8 V# b6 q/ ^( G$ D
////下面不需改变////////////% T8 K; ]# v5 M# _, ~% }, i6 z3 I

( R+ k7 T) P' ~6 X9 avar copyspeed=marqueespeed  e' Y& g9 M2 c
var pausespeed=(pauseit==0)? copyspeed: 0
* ?, ?& _" |' a/ t3 k3 n6 f! xvar iedom=document.all||document.getElementById5 I* l1 |' f9 |% d
if (iedom)
2 f& b2 M$ U; s% cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 K$ d0 H, p, H- M8 t: nvar actualwidth=''
% n* ~$ [" e7 g. x5 \var cross_marquee, ns_marquee
; X0 V$ f. h& X: m" ?/ J+ N/ G' u
. d( I% l/ v. Z9 U. ?0 a/ L1 pfunction populate(){
, A* @$ @& F. G+ B; r2 {' R0 iif (iedom){4 x/ k: U. e9 U4 M3 |# ~8 {& w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- [! r7 `! H; d* T7 D- W, W
cross_marquee.style.left=marqueewidth+8
% B2 R/ x+ H# }7 |; n" Q1 W: B6 Mcross_marquee.innerHTML=marqueecontent
0 ^7 A+ e6 c* v  M. W3 _4 ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( j) Y# `$ i& ]: ^& Y2 X) a}1 }7 R9 g, v' X5 d7 e
else if (document.layers){! T7 M1 S, B/ _) o% e, J9 }9 u6 k
ns_marquee=document.ns_marquee.document.ns_marquee2
+ L0 t  V7 f" T4 c( W' Mns_marquee.left=marqueewidth+87 n2 X+ ?7 C/ y! T# m
ns_marquee.document.write(marqueecontent)! }1 G) ]4 L9 b9 t/ r/ V# g9 O" n
ns_marquee.document.close()4 r/ g- C% U' l! P3 L
actualwidth=ns_marquee.document.width% E  t: F9 y2 |7 u
}
% \- S. S! @) G: s/ j4 O! b! jlefttime=setInterval("scrollmarquee()",20)
* j2 `  l8 u  [7 U# ]- f$ S5 f}
3 a7 |7 i# {2 _( Iwindow.onload=populate
( e  m$ s0 x$ b8 {6 H$ y" R4 l' w, Y* t) A" t* W* k
function scrollmarquee(){
  Q- q2 J2 Q4 z$ t1 U! _# kif (iedom){) P9 }. h& C. j8 x6 t4 f; I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 [: m: a$ O- G3 [& ]8 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 O3 m2 M) x  ~5 O! N$ Q8 _
else
! z/ b5 U5 X$ n& w; g$ J4 v9 u; tcross_marquee.style.left=marqueewidth+8' `7 s# Y9 T5 G3 @) a+ U5 D

7 S/ Y' T8 ]" Z5 b. a}- ~4 N9 J+ ^4 u: d# s
else if (document.layers){
0 @! [' b+ ^2 Iif (ns_marquee.left>(actualwidth*(-1)+8))
) f8 P3 ]; `/ Mns_marquee.left-=copyspeed2 a: _6 C% j* f7 n3 j; f+ P
else
* o$ |: s5 U8 x( {; I& \* Nns_marquee.left=marqueewidth+8
  O" ~4 N' P) X) z2 w. Y& U}, L) K/ r* _5 s+ k1 h- F0 L+ Z
}9 D& e6 C! `8 R. V/ Y9 a4 x5 R

* r* [! S, K6 u! r1 l& {if (iedom||document.layers){
) @+ P7 F& B' L! Rwith (document){
8 w: \! N& G. S/ ^6 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 F* ?" T& U# k2 a0 N
if (iedom){
: u3 `: l$ S8 C4 [1 W* Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 k8 v; m% {& j9 K% K; c4 O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ z9 a, d- L" n3 d8 i1 O5 uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) n* a7 e2 ?" fwrite('</div>')
  @/ j( \5 M3 {( K5 v4 G/ I}: E! L7 A/ o, e6 k1 d/ A2 t5 G
else if (document.layers){
) Y6 B4 x* g) b5 S7 y$ |4 i/ M% `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 ]6 `" @! l" [+ M4 Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 z, x* l4 ?/ l) x" ?8 u& T- F! _: }write('</ilayer>')
' r. Z: X; u5 D4 i" H}
5 H. E1 |2 o: \3 v3 e4 o- Kdocument.write('</td></table>')
. e3 I9 Y* w* x3 C# Y4 \}
& e- M4 r# a& a+ w- C- H}4 F5 Q. V, L. x4 E2 K* C1 \9 j
</script>

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