|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
y i% q1 r. `# B3 r6 i( {var marqueewidth=300
6 H( j3 e$ J2 U9 t: v& _//高度; W& h6 r- s9 K1 N" B/ ?2 M S
var marqueeheight=25
9 s7 ? D6 }! _" @; d//速度(1-10)
( T& `8 u( B) y6 I1 [9 Tvar marqueespeed=3
1 P, g0 O6 p- P) T, _1 L//背景颜色
/ \8 y2 D( ^% t8 {var marqueebgcolor="#FFFFFF"
8 r U7 ~5 u3 F) c e% t/ t//是否能暂停 (0=no. 1=yes)?) C! A! |$ y# |! T
var pauseit=1
9 ]: W- u% d8 J& z; J u& S1 b$ p- {" B/ c8 A7 D
//修改显示内容0 t# w% E8 {, r l( }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ t: d% @! F9 e3 s$ M- B
% M' {1 L0 C$ l9 t; N( |! o1 v$ G e: Z- A& Z' [) `
////下面不需改变////////////
7 S( Q) h. |# N/ h( a$ \/ T
( L* C8 ] Q5 `! u+ t. T* `+ {var copyspeed=marqueespeed
5 W. n4 I5 n, D5 ^var pausespeed=(pauseit==0)? copyspeed: 01 C& A- @ d* Q
var iedom=document.all||document.getElementById
+ ?2 H7 @* Y$ Y6 r- j j3 Hif (iedom)) B$ m8 _8 z6 b6 s- c* v8 B! }5 }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# x; h5 r, u8 }2 K- j e l; ]
var actualwidth=''
# k# s5 }0 {8 T! @var cross_marquee, ns_marquee0 ?) [9 g0 C6 D) V& `. J% N
. t9 U/ E# G( gfunction populate(){
# T+ C) `# X# k5 \- H0 D3 @6 bif (iedom){& A9 q! o0 Q- `! y1 m4 d, \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ L/ o% p( C; Q! Q9 K1 Tcross_marquee.style.left=marqueewidth+8
8 I: b! Y5 v" z$ j% xcross_marquee.innerHTML=marqueecontent
+ D+ U# y+ C# u. nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( ?% v4 h. q: ^2 s4 _}- y% V% c6 E& b( {1 p4 _
else if (document.layers){# g6 G9 b+ `5 h, m
ns_marquee=document.ns_marquee.document.ns_marquee23 w5 V2 x1 w* x# a$ I* { ^4 D
ns_marquee.left=marqueewidth+8$ g; N, N5 W/ g) j+ \3 G
ns_marquee.document.write(marqueecontent)
) e+ K# u, c# ?ns_marquee.document.close()3 }* v4 ?5 S$ p3 I9 W
actualwidth=ns_marquee.document.width5 `) K9 W' W J! E5 y$ o9 m
}
, O& b; D: t# z! O: ?0 N n1 wlefttime=setInterval("scrollmarquee()",20)
8 @ n3 O) s3 \}) I% ~, I# U! v2 n6 [2 Y
window.onload=populate
7 b" J8 N/ j- X: [: o* a! [! P% l/ J2 o- G& O! `
function scrollmarquee(){4 F, n8 a: T7 q5 t# k
if (iedom){6 F6 N `# }, |# K# w3 C$ J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# i% A2 x+ x [/ l {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( P* h4 ~; y2 W4 T4 g& aelse
, J7 m, b6 z" |. F9 Y3 N+ D" ncross_marquee.style.left=marqueewidth+8
% O+ D2 X( V" S1 f( T9 Z9 z* ?, O' U) L
" Q2 k4 r/ A: M% ~}' D% k4 s8 `# s& U; V
else if (document.layers){+ J& q( d/ [* m: y6 R3 [% E1 E
if (ns_marquee.left>(actualwidth*(-1)+8))
6 |' {% x4 s/ U: R5 s( _$ o& Jns_marquee.left-=copyspeed
- u& S- p3 }, x4 N/ ~4 j. Yelse+ ]. h1 V% S5 n, K; Y! n |
ns_marquee.left=marqueewidth+8
# @/ [# \" v) n3 R}% l+ w9 v F+ @
}$ r+ P, s: T/ a$ H" x A" |
+ }0 p/ E9 \4 ^8 Z
if (iedom||document.layers){
7 q+ B7 Z3 \8 Z" Xwith (document){
$ o. b9 u" _% h6 C1 G8 M4 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): u+ } q4 ^' \7 K6 _
if (iedom){
" l1 D- D$ @0 c! j* o2 jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') I7 h& m. _) |( Y" A' q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) |9 y; Q6 t+ I& _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! a5 B& n0 d; r( {! Q8 bwrite('</div>')
% B5 g, e# J! Q: {: ?}( a: G' [& ]) Z7 z" c1 x
else if (document.layers){/ L, Q. K% L/ N: P2 k- O
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ H3 |4 Z) q3 M% [% s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 Y8 t; ^# c" o) ^+ q% g9 I, t
write('</ilayer>')$ e; z- V( c: r$ h( h& g! ~
}
# Y7 u8 t. c) H# Rdocument.write('</td></table>')% p \3 v3 _! Q" L
}9 w+ F" p0 T$ C, m8 r$ r5 i
}
3 ~+ V4 T6 q9 \/ D7 B+ r6 a1 Z</script> |
|