返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 z9 f7 V6 W- v* Z/ R# x; `+ kvar marqueewidth=300: _8 a+ q3 q% Y* b1 `
//高度# X9 y% j$ D6 Y$ P
var marqueeheight=25
# n! _% Y0 \) n: J* O/ R% N2 o8 C//速度(1-10)5 C8 p3 C5 [& T8 W2 _1 c# V
var marqueespeed=31 f; d8 Z: F! L& ~! Q- J* f
//背景颜色
6 F1 E4 g1 z5 k9 S1 p3 [var marqueebgcolor="#FFFFFF"& p5 A/ I) p# k1 v- _0 G
//是否能暂停 (0=no. 1=yes)?& A6 {! _& e1 m# c. K1 t
var pauseit=1
- e# J2 x$ Q/ U' \# w' g$ h( z
//修改显示内容
2 Z7 M5 a1 W* l$ U# p2 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 ]' c$ Z8 @9 z$ j1 I( Q" v. Y! ~" {
: Y5 B1 |; g  i/ _8 s3 Y0 b+ X/ `/ r- Q" X$ e. w! s1 O) P5 |
////下面不需改变////////////0 K; [2 U& [* d( r+ r9 T' H; b* @: f
' x! O) H# a/ ?# n' y4 ?- r
var copyspeed=marqueespeed
  R- B) W' \9 [( l! p  p% bvar pausespeed=(pauseit==0)? copyspeed: 0
8 f4 C( @9 Y2 s# h  mvar iedom=document.all||document.getElementById6 A- w' i  v) z1 k7 S) c5 ^& v' j$ `; ]
if (iedom)0 Z3 p) D# L+ m* D3 I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ u7 D6 |) Y; t# c; R
var actualwidth=''
* m$ y, m$ L# c, c) J# h8 E9 ]var cross_marquee, ns_marquee
4 W2 q) b3 u! ]7 q# [
8 s8 ~; T5 M2 g6 m/ X" Lfunction populate(){: K5 ?6 F+ R0 |( _+ X1 _& G
if (iedom){% }1 _- H8 |) R- x; _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( `) g7 N' ~3 o+ j$ {  m1 m
cross_marquee.style.left=marqueewidth+8) Z# ?, B' h9 m) j5 w  N2 U6 O
cross_marquee.innerHTML=marqueecontent
! f, U/ S& P/ ^7 Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ M" V$ I; E) K/ F}4 G3 q' \6 E) A! Y9 S) Z
else if (document.layers){* g2 h. i  n# y( ?3 d$ Q: L
ns_marquee=document.ns_marquee.document.ns_marquee21 V; S& ?7 Z! ]! z
ns_marquee.left=marqueewidth+8
. t% L0 A; k$ Q& J4 J& |, l  N& Kns_marquee.document.write(marqueecontent)
$ q- O0 [, \+ X& a# Nns_marquee.document.close()0 g" L# y2 W8 `9 \2 y
actualwidth=ns_marquee.document.width
3 S" ?/ ~) u4 O; j5 V! i' |}
) {2 T4 ~, _5 p  v! plefttime=setInterval("scrollmarquee()",20)
9 ~# p3 W+ J0 M& j7 H2 Y1 N}6 K2 T7 Q! r% J( s& v- a( F
window.onload=populate  ?( K& C8 ]: i0 u' X  ^9 t) ?7 U

' n2 I: x$ t9 J. r, X# wfunction scrollmarquee(){
+ F( o( }* ^6 O- ?! e% Fif (iedom){7 Z: q. F8 I, V; i8 k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 z& ^2 t, u/ N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 ]4 u2 q8 ~9 u5 k
else: u" k7 J& ]  h. l' ~( }. |; ?+ U9 k
cross_marquee.style.left=marqueewidth+83 D) g$ o. j2 v4 _
( f3 m; b5 D* ]7 @, i3 g
}" d1 t& j% X# ]) v# t
else if (document.layers){
$ d+ r1 N. c6 C  J- Cif (ns_marquee.left>(actualwidth*(-1)+8))5 |& l, a7 F% s+ ?- `+ G2 H
ns_marquee.left-=copyspeed7 X- x1 P9 f' w% Z/ F8 y
else
1 u4 S: L' e  E3 r! h1 G2 B  Mns_marquee.left=marqueewidth+8
" L3 j) c  M. d; ?* X% y4 S}3 _+ ]2 Z' v0 d. o0 d
}& o  ~" n5 i- I% S
# r. ~; R7 F  @3 r) u1 E
if (iedom||document.layers){
* G8 b6 Q! `: Zwith (document){1 j; j3 X( H1 a% S( ~; ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 C2 s% R# t( W, I. F" F5 y
if (iedom){
0 F) Y) J% Q# b( Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 d; N, O% q4 I; \+ Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 k1 p  o" u( g, i  ^" S' I  K! z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ i) j( n. i) c. r* y6 g
write('</div>')
) S, Y6 z) G8 \5 P! F}
8 z% K4 n; }$ lelse if (document.layers){; V- Y) j$ T0 X6 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" v) h6 }3 h9 M2 c" k4 a1 C* ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  |0 b& M* v, t/ }: I6 `2 fwrite('</ilayer>')
% Q  q$ N+ _" }% h# t% f}% _) p$ ~  s* x+ S" C
document.write('</td></table>')
$ l# o! [* x2 S+ |}
, O3 s5 i- [  f( V}  x6 k( r3 I2 `- n& ?
</script>

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