返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 h* R/ i7 Z( t+ R0 e- Q) |var marqueewidth=300
# ?# O* b, l' x3 f  N4 T; D//高度( c" K4 K$ f) z9 ]2 e* L& r
var marqueeheight=25
; d( k7 U8 l0 k//速度(1-10)& N4 i) q! h, G5 a
var marqueespeed=3
& [9 T- ?5 r- i, x) F//背景颜色% ~% a% H0 V8 h1 G
var marqueebgcolor="#FFFFFF"
4 N) v- h! W* f4 e//是否能暂停 (0=no. 1=yes)?3 I2 H. Z$ f' Q( ^1 b7 [
var pauseit=1
+ w2 K2 G8 {1 I9 v9 ~' f) I- @& C
( }2 K* K5 c( G( x* y7 r//修改显示内容
1 F) X  y- H1 I; Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- e0 L( n$ R. I" m5 g- E9 R* g
( S7 K( w1 x0 \+ x" @
: T1 {# H1 [: M( u8 `7 E////下面不需改变////////////
' e7 B& m1 E" D7 W. Y: V: A' L7 y7 b
var copyspeed=marqueespeed. s3 H; A1 Q1 w. X  }/ y4 Z( u7 r
var pausespeed=(pauseit==0)? copyspeed: 09 N& x* a5 J9 p: P: f$ J8 m( [' A
var iedom=document.all||document.getElementById
' `  f' q& u9 `4 ?% _if (iedom)
% R, Q4 q7 W# j: y, M" j+ F0 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 d+ i/ t2 j- w9 g& hvar actualwidth=''' i6 a3 A6 ]4 W  E8 |
var cross_marquee, ns_marquee8 b/ m. c& U# a' p9 b, V( c. u  a; a
( _5 y: E: M/ ^0 {
function populate(){( o8 B. V2 Y( f; e
if (iedom){7 a, \& s% G' K4 E6 @8 Z: z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- b/ j) B  |& N! P
cross_marquee.style.left=marqueewidth+8
0 H- e# _) Z" m! P5 c1 N) t  @cross_marquee.innerHTML=marqueecontent
# K# {6 [  c4 A* v# uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: M8 m! m4 ?5 g' f  A. l
}
7 q$ `: d( R7 Celse if (document.layers){
( ^2 K, @, r  y# Bns_marquee=document.ns_marquee.document.ns_marquee2
, ?! T( e. I8 g0 P( D, ?3 i) \" fns_marquee.left=marqueewidth+8( p: d8 B' ~* f5 u4 L7 V
ns_marquee.document.write(marqueecontent). J5 |$ ]! D! U
ns_marquee.document.close()
) W5 O$ O  l& w8 B% W% P9 t, Iactualwidth=ns_marquee.document.width  H2 d! {+ ^; N5 q8 g, N
}
! k8 W$ z, K6 `0 i, y# nlefttime=setInterval("scrollmarquee()",20)6 F- n. ~3 J' a
}+ _0 s4 [5 C7 ?: i% h2 Q# p3 I# T
window.onload=populate8 `; _- Z* s! T' Q( U0 c4 k
% ^2 t6 `5 D' S# Y) c
function scrollmarquee(){+ i& _% v! \) J7 Q# N4 E
if (iedom){
( ~) |$ f) _2 t. E( Q. D+ sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ J, U/ Y0 U$ I9 v& t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" T; E! `" `' i' w) B& |
else- c& F  h% {5 W: b
cross_marquee.style.left=marqueewidth+89 M4 Q1 A$ w8 Q5 B7 g
% z9 z# ^: `* [# f: m9 G
}! r" v: `- t/ ]" j
else if (document.layers){
/ w5 z$ \2 i0 }5 P8 _if (ns_marquee.left>(actualwidth*(-1)+8))  o0 v7 m8 o0 v0 H* X4 J- ~! l! a
ns_marquee.left-=copyspeed
' r, T( `5 j4 R( A/ r( ]else
, u% R( h) H! ~- f9 R( N- yns_marquee.left=marqueewidth+8
9 O9 ^8 q% v. k# l) g7 H( w" v}
% U6 l+ R2 e1 k* ^* p  ]}
, \6 Y7 u5 T; Y1 J3 n. V: F! f- E: A! x9 Q( r8 D7 a. }/ c, \
if (iedom||document.layers){
6 {  O+ u0 x; J3 _! m, P* X$ x! hwith (document){! H- Q5 y1 Q: u3 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ h. D& b" D, @: B2 H
if (iedom){! y. {- y' m- a# I9 l& K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- E! a# A" [6 v, i+ u8 L) x7 v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 E3 N) u8 j; G, O, N% kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; {( x3 G& f1 {+ H/ \write('</div>')
  k( T& F" O/ \7 I/ S, x}
8 d; J! o) M4 m5 w4 R9 H  welse if (document.layers){
; O9 m, G- c# Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) D7 V8 n5 T. r. ~. p9 u6 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* H5 p7 Z( X  D6 b% y: Q& V' g
write('</ilayer>')
( |: ^  B) d! [, z9 b2 g7 _}
5 X( T, U" y- R) V2 M# u8 U  rdocument.write('</td></table>')
' @( s5 i( p/ s3 K. [0 T- a. w}
9 @6 X1 l9 l0 F6 }5 v+ Y5 ?}
- s. ]+ |) w/ v</script>

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