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

|
网页之跑马灯文字特效
//修改宽度
9 E. W) R' {7 q4 x' ?. U9 D% }5 rvar marqueewidth=300
% w ?+ A! D* N5 ~" u6 ~//高度
6 Q: q4 e9 q/ M' Rvar marqueeheight=25/ @2 @0 t4 K" W6 o6 a! l
//速度(1-10)
$ _! q! m) }. |( Tvar marqueespeed=3
8 p2 V8 P, d. }: C//背景颜色
X# T3 ?: D% k% {* ~var marqueebgcolor="#FFFFFF"
) y2 _0 B* k! U% h W4 h//是否能暂停 (0=no. 1=yes)?
0 R v) R, U: P( _/ s! \9 Gvar pauseit=1
: r& V' B1 [4 Z1 I1 \% W+ `4 f+ ?+ P) q" `% b
//修改显示内容4 z. I- x/ w3 m; f9 U" d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ @, o3 I8 f" s0 n
p( d9 @4 {* Z% C' s& o2 a7 i
: L0 `- J1 O Y ?, ~////下面不需改变////////////
8 m, z3 g8 B. |0 o6 B
/ q% U* Y" Y; a. uvar copyspeed=marqueespeed
4 @) P8 E: N. o7 ^) kvar pausespeed=(pauseit==0)? copyspeed: 0
; Y; c! S* a) j2 ?* {1 {5 d1 Svar iedom=document.all||document.getElementById
, r. t; h8 t+ j7 v! o2 r; ^if (iedom)
* l- M4 x% X! F: p6 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 j+ l* ~ ~4 q1 e( v y" avar actualwidth=''9 }1 Q* I2 g6 | z
var cross_marquee, ns_marquee: K. o; a6 q8 u3 F6 A. k% z
5 |2 g) z6 {( y9 L0 p' h+ v2 X
function populate(){ ]9 c v7 |# z, I2 X
if (iedom){0 }; H& |/ n: \- e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 g# f' E; v$ Q4 g5 s5 B3 B
cross_marquee.style.left=marqueewidth+8
$ p/ |1 [/ P" y0 k2 Zcross_marquee.innerHTML=marqueecontent! h* z# x4 |! u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" H5 K! I, K# Z. U
}
0 Y; v0 ~ T' a) j/ c6 q; Telse if (document.layers){
0 w( t! m* U8 N" y" ?' n' Tns_marquee=document.ns_marquee.document.ns_marquee2* \9 o7 j/ [- _- p5 x
ns_marquee.left=marqueewidth+87 A4 W- V" Y M* i: E/ d
ns_marquee.document.write(marqueecontent), {. i4 |' o) Y$ b: @. \. Z+ W
ns_marquee.document.close()
, }6 D- r' L- |. ?8 D: ]3 K, w6 G ~actualwidth=ns_marquee.document.width8 m0 ^( J+ O& [4 w2 S2 N
}
7 q) s1 I# I) x1 g1 tlefttime=setInterval("scrollmarquee()",20)
* g$ N& n. y% h- p' c' D5 w}7 l! _$ k( w; G2 q, d+ ~
window.onload=populate9 K! f8 J! l7 h) g: z
# B/ ^0 B: M+ K/ Afunction scrollmarquee(){
0 L$ F' I0 a: o9 G" ?+ K! d% D- ?if (iedom){
$ h" o6 z7 ~& j( ^8 H. N$ [6 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( f2 B% K0 O, R$ ?' C/ ^0 I5 A) Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# u- w8 f( V( R- V8 I2 V
else0 n) ~: G3 D) L
cross_marquee.style.left=marqueewidth+8
' P6 ]0 R* g$ D" K8 |0 g" p0 P r
" i) W+ K* b: R o+ @. l}2 C9 E* v/ [. K9 I3 ]% R0 `3 X+ W( `9 [
else if (document.layers){
+ w( e2 F g9 m, l2 l! uif (ns_marquee.left>(actualwidth*(-1)+8))
4 }2 o3 h; w6 z+ n! Ens_marquee.left-=copyspeed4 D3 ~" K6 Y# R
else
$ @6 `! L& u) A; j# E4 uns_marquee.left=marqueewidth+8
T0 j, z2 q& H; E# J9 M}( Y+ D U3 y4 D# u! f; A' ~$ `! e
}9 Z0 Y' _5 R% _7 K$ j
+ A( i5 y# S: F3 u
if (iedom||document.layers){
5 s. r! v' D* ]& @with (document){) E1 M9 u" ?" ^( D/ t) r) b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 b2 S( ]9 p- `! N6 C2 R
if (iedom){
! j, o# ]5 s( W" c4 x. v, k2 @5 Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; x$ {& d) c' h% h8 D% Q R7 O. Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 d' D% A8 g3 f/ a, ^2 H2 b1 `' iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 E/ c- W; @* S! Y0 A2 d
write('</div>')
5 Q' ?2 D# I/ ?: K& x3 C}6 O* z* ^5 _1 Z. L
else if (document.layers){* o* x8 j1 P7 ^6 T. ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 e' ?- F9 A. R: a: Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 c( [1 N0 N! u) J" o' l9 \9 P
write('</ilayer>')" l; s1 }9 b; B' C
}
% g: l7 Z" ~: V$ Z, ?document.write('</td></table>')
/ W4 a% z- G/ E}
2 o8 y; B% b7 J. m& \7 k}
; I7 d8 O0 u: `. C* G x K0 Q</script> |
|