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

|
网页之跑马灯文字特效
//修改宽度
$ i7 p9 f% o% }3 b! N# A1 l+ r0 Svar marqueewidth=300
: [ Q0 _9 Y3 I: J @9 J8 x//高度
9 |6 s V5 s5 |- N" V: Z2 Rvar marqueeheight=251 V) T7 X' {! b5 T7 l" b
//速度(1-10)
/ q9 U4 q+ g- k* Ovar marqueespeed=3! t1 `1 T6 ~$ [) w9 r( g/ @
//背景颜色
* ` F S* Z- B. bvar marqueebgcolor="#FFFFFF"7 E( [& B- p3 B' C0 l
//是否能暂停 (0=no. 1=yes)?5 S9 _) z; h" q8 _3 W
var pauseit=16 F5 m( E |1 e8 k4 E1 f
3 b, n% o/ H- l2 x$ W$ {//修改显示内容
" p. o: u, P4 j: F5 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 `- r n, y$ W& [9 g
, I9 S5 y- T0 M" J/ ? ^3 f. y9 t2 g0 _# @2 u
////下面不需改变////////////
. A: y4 a( l) `( i8 `
9 z6 f: G% O6 r7 mvar copyspeed=marqueespeed
9 d5 M7 J- I5 B, E! bvar pausespeed=(pauseit==0)? copyspeed: 07 z+ n/ Y( x% R2 E/ ?
var iedom=document.all||document.getElementById
' \ @* O) X# Z1 oif (iedom)
+ w2 {2 z9 G z; kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# b( s6 h D/ H# h' S9 vvar actualwidth=''; R1 v( k2 b1 X( K2 u9 l$ d8 E
var cross_marquee, ns_marquee
7 {/ H6 h! `4 T8 V; a: g r
9 r9 }% X3 X bfunction populate(){
- u/ G( J) c: L+ Bif (iedom){/ ?' ~0 L6 f; v/ |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! O, u8 p6 y% G: }cross_marquee.style.left=marqueewidth+8
- l! P e8 m. e0 ^5 Z4 Across_marquee.innerHTML=marqueecontent
& e: f! H( K( j! f) f" pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& w0 B& U9 S& `1 v
}
! Y" P, [% i% v! L1 Z: S( velse if (document.layers){# N+ Q; |5 J: X
ns_marquee=document.ns_marquee.document.ns_marquee2) q: R/ H7 y/ L( C" j# m
ns_marquee.left=marqueewidth+8
! H1 X9 @) s8 p5 @8 rns_marquee.document.write(marqueecontent) J9 e: l# x1 m8 n5 L) f7 V
ns_marquee.document.close()
6 \! r4 t2 P# ^1 dactualwidth=ns_marquee.document.width& r0 j& Q, l T) t/ f: f
}7 C9 |+ K$ N: O6 g. H' L
lefttime=setInterval("scrollmarquee()",20)4 S9 J6 |, v8 I1 [ z, n
}
, [, E1 g! b, T0 o' @window.onload=populate
3 N! z5 [" f% c/ W; U/ Q0 K
0 v6 S! N% \% sfunction scrollmarquee(){- l8 k0 e0 v, Z7 y% C; p% Q
if (iedom){
6 e% F4 A' @" a9 O% K0 X# lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( m3 |2 D- D9 Q% j; D" P" u+ Q' K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 h) \; z4 T/ U% g$ V6 J! Yelse) u. [: p7 L) Y1 p) ?6 g0 u
cross_marquee.style.left=marqueewidth+8
* i8 @8 t H8 p% I8 y3 V7 x: U% Z7 z$ L
}
# Y) U" _8 a& O" Yelse if (document.layers){
+ G0 W! W" R6 p% z4 K0 h2 {if (ns_marquee.left>(actualwidth*(-1)+8))* g9 e1 I" T$ G, X
ns_marquee.left-=copyspeed
2 a% ~* t6 y8 f+ W$ r) @6 yelse$ _: ]' ?) a0 E7 m# D L5 q
ns_marquee.left=marqueewidth+8
" H; V( Q) V/ u, J# S}
6 V$ q r( Z% U: Z; C4 }}
6 ?7 g' B0 w" B3 ~8 k# ~* b0 M- U. Q4 {1 a4 L8 ^! b
if (iedom||document.layers){
$ a7 q: x' w$ Q2 F6 }with (document){1 e( P" a$ B7 l2 y' @1 r' B) T- k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- P5 g# s! |& n2 g0 a8 g! mif (iedom){" G0 z h6 z- w$ _8 d- i- [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 L7 {: D- y0 Z* C6 fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 d! B7 W+ J$ }9 z" U8 u1 v- t/ }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 [0 h" v2 P) J# \5 b% D
write('</div>')
- G" O4 o9 ?! L) h0 W+ r" m}* t! ]! ?: q& v1 K
else if (document.layers){; T2 Q' h3 L r% a/ r6 L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" D# t& ]( T. J; y$ vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( t: f3 p( e' r# Cwrite('</ilayer>')) ?6 _% u* D o/ k% x& h- M
}! N* O4 C$ G) f+ @% m, K! ]% K3 j
document.write('</td></table>')
" p6 W( J' k- m+ ^# i}
6 f9 b1 x+ D& F* u; y5 O. E}, E7 {! q2 A. i \& M6 ?
</script> |
|