返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 H0 {- B5 x; C: P# Q' Hvar marqueewidth=3000 Y) K' e  b. G4 a
//高度( R5 K% x7 f! U( E1 F
var marqueeheight=25
  O1 ~* b" s- P0 Z* M% P//速度(1-10)
1 \& h' w5 k9 d$ [2 Z+ H8 svar marqueespeed=3  b$ @  m) G! L. H
//背景颜色
& n; c( W) T4 E- b8 N. vvar marqueebgcolor="#FFFFFF"2 w( \  f8 X7 K" J$ N
//是否能暂停 (0=no. 1=yes)?7 s% S1 a4 W7 `+ h% d
var pauseit=10 |) N) u6 x- W

( c  P; H: h" I- q8 @4 I//修改显示内容, I7 a! p# W* s4 ^7 V' C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 }% J6 l7 f$ Z' l; P0 m7 }( k

5 p. D8 Z9 i( F! ]6 Z- V& I
. P/ }& n3 [1 m; w! y////下面不需改变////////////; ~; `& K- t3 b. j
. d" r- R; Q6 `/ W. g
var copyspeed=marqueespeed# {9 a# O1 f! l* j+ u. \! ?7 y
var pausespeed=(pauseit==0)? copyspeed: 0) g, [* y- m- w, i# r, K
var iedom=document.all||document.getElementById' d( }( r1 O3 r, G3 _2 y, O7 ]
if (iedom)3 r% X: c& q# b* M: T9 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). Y7 x6 N, ~. v
var actualwidth=''
8 [7 ?: J1 f! H2 tvar cross_marquee, ns_marquee
9 e5 H- X# U/ {* a
0 a: d; |3 B% M2 U. Y' E: b& qfunction populate(){
' A# V) ?0 P8 q  [6 i5 vif (iedom){4 n$ A& i- b& E# A* D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 [+ V' ]# \/ G: |* X9 ucross_marquee.style.left=marqueewidth+8
5 _: b, S/ x- i0 c% q/ Ucross_marquee.innerHTML=marqueecontent
) `+ N# G3 _; F8 j: k# H" vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ O$ ^, @; H6 C9 F}
# R. _) l" H# s4 O0 |else if (document.layers){
+ S! J* k% O8 c$ ?ns_marquee=document.ns_marquee.document.ns_marquee2" o1 @. z8 l; m
ns_marquee.left=marqueewidth+8. A0 C+ U; j. {: b. F7 e
ns_marquee.document.write(marqueecontent)0 h. D2 m* w2 ]& A3 H
ns_marquee.document.close()
: O7 v2 I  F& j) o1 factualwidth=ns_marquee.document.width
9 u9 m  p$ p9 @) Y! X9 m4 F/ Q) [}" k# D- M4 w9 v7 l5 ?
lefttime=setInterval("scrollmarquee()",20)" V% K0 |$ J8 m
}/ K6 s. N0 ~; B, k. A
window.onload=populate
% |0 N; b2 S* }& t* q3 p* l- k8 ]/ j( R
function scrollmarquee(){7 y1 H. c3 S9 X
if (iedom){/ u2 ^6 F3 i$ B) |( W% ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ [- V3 T' y! {6 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- m( U" ?. k0 X/ p' g0 O
else
% e  S; T: \0 zcross_marquee.style.left=marqueewidth+81 Y8 t; ~/ B3 i0 t) n0 n/ l: y# Y

' M, t# s1 E, [  d}
7 q6 P( u5 D0 Gelse if (document.layers){
  I6 H, q; I. V) b& Z: vif (ns_marquee.left>(actualwidth*(-1)+8))& n) T! D) r7 y' a3 {4 z# c: D
ns_marquee.left-=copyspeed' }2 d! @/ Y% ]
else
- y8 N! l+ s, `+ ^; |1 dns_marquee.left=marqueewidth+8
! Q4 H, U* @% \) \) A5 V3 J. E3 g}
' l8 J+ u/ }7 K( M}
7 V6 f  m# [0 u/ e# X1 c6 g
3 e' J" V6 Z( Mif (iedom||document.layers){
5 L% M' |1 ?  U  \with (document){
( I+ E5 r6 f) V! M0 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 V2 |8 ~$ O7 W# eif (iedom){
) B# m0 R, q4 C" ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& n0 M3 l  W# w8 F9 _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% h: V* A, |( f; p) `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; H1 ]( k( a- U% l1 P% x4 S+ m  Wwrite('</div>')
4 ~: x$ [5 @1 T( `}$ X5 A, H( y$ J* l
else if (document.layers){
' V- k9 Y9 }$ y" w1 N. fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# }- @* C5 p, Y$ l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 Q+ `& n" D1 u7 a- X
write('</ilayer>')2 G$ N% r6 @# i7 k2 V# H4 i
}- Q! F9 W2 A. ^$ e( L; t
document.write('</td></table>')! ]% t$ G4 q# N- Q
}" |. w0 }7 r; N% k
}
7 P4 w) `5 ~0 A/ y2 ]</script>

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