返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 r: k1 ^9 u: i$ Q- L. ?  ^var marqueewidth=300/ R, S/ F; ^! K" @% G/ }
//高度( k7 Y- j2 ]& x
var marqueeheight=25
& R0 I9 b0 l  W, Y$ J7 S//速度(1-10). y6 v1 T5 o/ c4 u3 v4 u! y
var marqueespeed=38 g3 M& _( |# h
//背景颜色
. L# l( {. c+ s5 l9 ovar marqueebgcolor="#FFFFFF"
" V/ ]- e. g& B. P* w//是否能暂停 (0=no. 1=yes)?' C) s: t; M# V6 H6 B# [
var pauseit=1* v$ U/ e$ F4 v1 d

1 ]3 b+ A3 d/ y) P//修改显示内容$ f! L+ a  J& l$ V  K$ t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" p! V' J! o6 O* {3 n/ K  ~

% c: i! T* O7 c8 A8 r4 w  `
$ v, J8 R* S- V5 D+ J////下面不需改变////////////
$ m6 F& ^/ g! R3 B# f; b) V2 @2 R+ h$ d& \5 |( T& T0 C
var copyspeed=marqueespeed
& Y' o, e( F/ c  g  }& i- i* Z4 `var pausespeed=(pauseit==0)? copyspeed: 03 t9 i% O7 R4 f& Y" s! K* S
var iedom=document.all||document.getElementById- j) x1 ]( j' F7 d$ T) y
if (iedom)
5 F: C' V0 I) I! \6 v( Mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" }  c7 O0 ^9 d3 A" g% {7 bvar actualwidth=''
1 \+ i- D+ y# Wvar cross_marquee, ns_marquee/ R' y# c$ T8 c. t9 s9 t3 ~
) W% W$ |- P0 q3 k1 e+ s. H- u
function populate(){
, o8 b' e- h: }' m- K* U$ g7 Hif (iedom){( \; c9 Q1 Z, k& C; Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: v# p1 L% E8 z$ q
cross_marquee.style.left=marqueewidth+8/ p) P% M) V+ J$ p* D0 K( p
cross_marquee.innerHTML=marqueecontent
" V( r( m/ e$ L1 ^! W; D6 ^1 E' R" ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. G* N) {3 d7 k- }
}
8 T! R( o/ b; h! x8 i5 a2 i8 _else if (document.layers){" U' o; f2 j& O' `: e' ~  Z* J+ B5 G
ns_marquee=document.ns_marquee.document.ns_marquee2
  x( n% i" L- X; [0 K6 yns_marquee.left=marqueewidth+8
* l& m0 a6 v/ Kns_marquee.document.write(marqueecontent)
" b* t6 A3 @$ w$ r1 [, B$ R# ]ns_marquee.document.close()
0 w! w+ E2 H6 O0 p6 x8 s! Q! w( C- qactualwidth=ns_marquee.document.width8 t$ z# I/ [# S
}
/ Z6 X9 E! s! Z# l4 Z/ P& e, olefttime=setInterval("scrollmarquee()",20)' @4 q4 a# y) S/ }5 l
}3 H0 v3 P' b: \5 d9 g' G. r! I
window.onload=populate
$ O" U& n- b1 w4 t5 ^6 K; B% d- F- ?$ ]& W  C- g9 L& W
function scrollmarquee(){, [4 w- W- H: v+ X, A
if (iedom){
; }; O# Q6 r7 t" ]( Y0 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# v; U. ~/ y$ T) ^3 {3 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- ~7 h4 _/ f# \- [else
0 _  _8 N7 y' i5 h# W3 u' fcross_marquee.style.left=marqueewidth+89 i, z( I4 a" [2 [' ^+ [5 k7 t

& _) U( r; g) P! f5 b' @* Z}; L' [6 g' P4 N. J% P
else if (document.layers){
* C, E3 Q$ B6 @2 ]% i0 A  cif (ns_marquee.left>(actualwidth*(-1)+8))
! U$ A" ^; [) rns_marquee.left-=copyspeed
% {: {7 k( Q' N( celse9 C1 I, e( B/ h
ns_marquee.left=marqueewidth+84 G& n6 W7 w4 n+ J
}; w* \/ }, k$ E1 d( \
}
0 [7 A! a& Y1 v' ?7 J( T7 `! z
) t2 n$ `% @1 v+ Lif (iedom||document.layers){2 L- V9 i* h+ f/ R. Z- V3 r* d
with (document){
1 ^# w& @) {4 J  H: d# Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); _+ l4 Z: m: e: [( |" }. q
if (iedom){
' u0 x" s1 B6 o' s+ J8 o' fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! R" n* O% }1 W) T/ v, e* ^* E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' {$ ?" C) V& k, u' _! [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* t$ I  C" c# X7 ?- x
write('</div>')
; G; D5 ?0 {* e3 z}
# J4 n, x0 H$ \' o! \) M% lelse if (document.layers){
; J; A6 C, Y8 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  W- u$ H. K: Z) N7 `- j5 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 d( h  L6 u1 o8 {! B+ D/ W+ _write('</ilayer>')
. O9 P' {# M' t# N0 R}
1 e" T1 l5 ^$ ndocument.write('</td></table>')9 u1 Q4 r- n$ C) ]
}
5 h  F' y7 f( F8 Q7 q  a! g}
# [& {( u1 M& ]2 G& c, m</script>

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