返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 O' I, `; e  Q, f( T" a
var marqueewidth=3008 f( f7 ~# \7 l1 q1 m5 e
//高度
& b4 |9 K7 g. n$ Lvar marqueeheight=25
- ]1 B  Q" e& G: O( W  c' B1 ~/ s//速度(1-10)
2 E$ x+ o4 y/ gvar marqueespeed=3
1 B( O8 X0 P; y8 _3 `% U' L//背景颜色
5 ?8 J3 \+ R8 Y6 lvar marqueebgcolor="#FFFFFF"1 _3 x: k0 S0 Q
//是否能暂停 (0=no. 1=yes)?
. q8 g* m1 E( ^% s7 y9 X; _( V( Gvar pauseit=1( A) F: u1 c: U/ j9 ?% j! I

1 N: \0 U! z% w" X  \0 I//修改显示内容
5 u' ^; w; l  Q- P8 P2 \7 x; U" tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- u/ G+ S9 a/ b: N3 m2 w, I9 y( }4 l2 K" D  q
+ f/ l) a0 q+ {/ u( @
////下面不需改变////////////, O4 R8 b( r2 d8 \. ^$ I
6 T$ D/ K( k: |- v) Q7 _6 p5 r
var copyspeed=marqueespeed
2 L) o! V  q. |. ]var pausespeed=(pauseit==0)? copyspeed: 0
* o5 ?7 R/ r( ?var iedom=document.all||document.getElementById
1 ^8 _( Q$ c! K3 @: @5 s8 uif (iedom)0 M, ^1 x4 x  O' N0 u  I* z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ E; F) |7 w8 J$ G% Y3 q, Wvar actualwidth=''
5 P3 x- Q8 v$ u( n$ s3 W6 _. xvar cross_marquee, ns_marquee2 Z2 P" T7 Q8 l9 p0 z: Z4 g( c0 O
/ E2 M  w, Y$ f- |
function populate(){+ @7 d" F' M& O- ^; ?9 s4 e
if (iedom){
0 ^6 s/ i0 R% s# n) Y5 Y5 [3 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 D: [  [* j8 h1 g- t% y0 Tcross_marquee.style.left=marqueewidth+8- N( n1 N0 Q' x$ ~, V
cross_marquee.innerHTML=marqueecontent" P6 [8 U) k+ D' _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ `, ~9 z7 V! T8 t# g' Z}
) ]& a: N" u0 N" l- r' a7 ?$ Telse if (document.layers){
' F& H" g6 L: \7 q9 c+ uns_marquee=document.ns_marquee.document.ns_marquee26 t9 N: y$ }0 _3 B  y/ A4 b  X' ^
ns_marquee.left=marqueewidth+8# o! h  d0 _" ~4 Y0 a, a- r; ]
ns_marquee.document.write(marqueecontent)
7 E7 d! b. L8 Y5 G. N5 \. Ans_marquee.document.close()0 v+ C* k8 l) {4 g' z$ H+ S1 T
actualwidth=ns_marquee.document.width
9 w  i" V" |! q}
8 d9 f7 w$ H' z0 r8 {2 a. Q; Alefttime=setInterval("scrollmarquee()",20)
9 M% K, D2 l; Y1 _}; T& S: w; ~, u
window.onload=populate
6 ?- U4 ?7 h9 O
8 J7 P+ k, y0 B$ o* C! q) {function scrollmarquee(){( t2 j9 t3 }* @
if (iedom){% J7 o" @; J( f1 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- O6 g6 P; _* P( B- c1 j( zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' k  ?$ }# M6 W4 `8 A) E. q% T% [else  C/ k5 C* O4 A) j% |! {
cross_marquee.style.left=marqueewidth+8
5 [2 W% X# l8 y- @2 V/ D
- |4 e' Z! ~/ ~( T}& e8 x4 a) _' ^0 n  b5 _/ k2 X
else if (document.layers){' M% `* s" N  R0 {# v* u
if (ns_marquee.left>(actualwidth*(-1)+8)). G3 P/ O( L6 `, e5 J
ns_marquee.left-=copyspeed
2 ~1 z/ g+ k6 Y) K! _! Telse
2 g; }1 Y7 A, U( r+ d/ u* _ns_marquee.left=marqueewidth+8
" Y. z0 }# w8 ^0 S4 l6 e1 r}
+ h! ?6 @8 A' u2 r% ~1 e}% P+ q% {$ ?/ ^

# d) g! J; F. p0 G7 I) I/ T4 F% Fif (iedom||document.layers){& A* g/ H$ r9 u( Y' f
with (document){
5 \. V. @9 J7 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 q! U0 c1 R, i  S# X. _! t7 Z
if (iedom){) d4 ^$ k, D8 L& `' _( \* F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' z" _+ ]) R! o. |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, M. G& r& q) u- v5 g1 `; z& S0 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 V8 ?' ?+ t  t1 Cwrite('</div>')
7 s. {& X! L1 n' t  s4 K. B! U}
$ n* q4 @' N1 ?1 O- r$ Y8 Kelse if (document.layers){
8 r' _1 c& w! A0 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 _. P" h$ f" P6 a, c/ \! k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: V  R* @; h1 B0 p/ u, p! Hwrite('</ilayer>')1 R: y  U4 [  E4 `" C
}
1 u! ]  t/ r  ^0 X. P& t* Y" v* G0 Ldocument.write('</td></table>')
- r: D) x, X+ g" m' i6 K# Y& X( B}
$ j- k' k# V. X}" A7 l; z8 Q4 C" n" H! ?
</script>

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