返回列表 发帖

网页之跑马灯文字特效

//修改宽度# W/ T# b* ^4 W* }+ |# m$ ?1 k
var marqueewidth=300
1 e# O0 T# G( J0 W6 D- _) P% P3 z9 r  u//高度
) J: V# d: R0 ]) d: Lvar marqueeheight=255 ]; [4 c* Z) E4 {3 ]  `
//速度(1-10)
$ G9 ~. u# {% c8 O& `1 ?var marqueespeed=3
  E7 I4 b& U% ]4 Z( N& w//背景颜色2 t& R6 L$ F2 P0 X
var marqueebgcolor="#FFFFFF"3 L+ v$ c1 d8 j/ v) T" f
//是否能暂停 (0=no. 1=yes)?
8 Z5 Y- k# X  z8 j: qvar pauseit=1
0 w% P' |' X: N$ b7 ]; M$ d
7 R9 x. I6 C, X& O1 O//修改显示内容4 Y- r  E: z$ T6 x5 U2 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" X5 K( F/ m9 F, e* O8 X" Q( v; \7 Z3 }: [6 p

; U; s+ A" i/ u3 s1 T% N////下面不需改变////////////
" `0 X* Y. E- E8 A8 F: ^
; Q: S8 @2 ]7 Q* m$ L' d. F/ ~! Fvar copyspeed=marqueespeed( W/ P6 U, ~# Z8 d( s
var pausespeed=(pauseit==0)? copyspeed: 0% ?; {* w  X) S% X/ B' `
var iedom=document.all||document.getElementById" K) ]6 ?* W# a  m6 D
if (iedom)
( J5 H8 K* t( b& O0 K& Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# `3 T' F! ]& L2 p9 R+ T) j
var actualwidth=''0 M  f* F' m- q
var cross_marquee, ns_marquee
" j9 \3 N: h. h+ E0 L' ?5 c# B+ p! Q9 F( q
function populate(){
$ e+ l- E( N: E1 |! z  m# sif (iedom){3 D  P# g/ C5 @' G2 l  L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" [0 ^: I4 h: C  G
cross_marquee.style.left=marqueewidth+8
9 K$ d& _6 B; ~  f3 I% Q% hcross_marquee.innerHTML=marqueecontent
% D; D( x2 H' v' a! |0 V& ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" u: w: T& X) ^; B6 J# o5 A
}
# M; q# |. P$ [( Celse if (document.layers){
8 T8 F2 p. e& f  o1 ons_marquee=document.ns_marquee.document.ns_marquee2' q/ J2 j5 V# O, x
ns_marquee.left=marqueewidth+85 s+ e" ~/ }% S# E  A& t# A
ns_marquee.document.write(marqueecontent)
) R, T+ w: J- J1 s1 {ns_marquee.document.close()7 r1 \9 X3 d" C. H
actualwidth=ns_marquee.document.width/ \1 N0 a: P! ^- c) E
}: f! C+ w6 q( J: o% a& v
lefttime=setInterval("scrollmarquee()",20)
& x8 x8 }+ U2 M8 }/ {( D}
7 e& U3 m: u8 K9 b+ Uwindow.onload=populate
: [6 G$ E; {% H6 H4 p6 Z& v8 `; T( n+ |, T
function scrollmarquee(){
- L, ]6 ~! N& Hif (iedom){
) W) e: ~6 S" L. b6 F6 f+ gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 B: P$ p$ T9 ?% `- H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 @8 M  t/ i. ^, Felse, ]: \* t. x8 ?
cross_marquee.style.left=marqueewidth+8
$ Q4 {6 T, W% L+ q# E4 r# a7 U3 |6 b2 v  L6 A* }+ ^& M
}' {- x& x% x# a4 F1 y2 p; n( s1 Q
else if (document.layers){
, F2 |* |, B7 ]+ \* e. Q! j) \if (ns_marquee.left>(actualwidth*(-1)+8))
: J# f' H) i- ]% k* n0 v' vns_marquee.left-=copyspeed8 z! |5 S7 G0 o
else
* {; q' C( F' V: j+ A1 h/ rns_marquee.left=marqueewidth+82 T% B6 \+ U6 M+ m8 E  p
}7 ?7 n$ ?; |5 Z# G8 E
}
) v4 V# i" m% K2 h) G& g! L+ d: ^' ^1 Q+ P
if (iedom||document.layers){
) L) [/ i; o# r' e3 zwith (document){
5 d5 `( F% h9 e& k" t( Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). [$ @5 X3 {, o5 y- c; @) N! x7 N
if (iedom){
- n3 L( [5 X& ~3 m& Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! y  {9 M6 J; p$ u2 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! }# g  e/ g/ X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- ]& Z' J5 U! L, b+ |write('</div>')0 P$ v# [; D% L8 C+ ]& t
}, z" T( P. u4 k! P/ p
else if (document.layers){7 p3 `/ g9 Z9 i8 }+ O/ J7 T3 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; X7 a' h* n% k' U# w" qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ j9 O4 h& P# a  lwrite('</ilayer>')
" O9 N  [8 s5 R3 b2 {# K}% h* K: A1 _& b
document.write('</td></table>')
. [. j7 s4 f- g, }' c. J. {}
6 e0 o$ p* `" B}
( F  `6 P* F9 i</script>

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