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

|
网页之跑马灯文字特效
//修改宽度
9 O8 \" n0 u+ k$ J% mvar marqueewidth=300
! m$ V4 U- Y8 h; p//高度/ } Y4 F& W2 W* y
var marqueeheight=25$ t; W' y- ?8 H: ~& w
//速度(1-10)& L, Y8 C) U$ F% U
var marqueespeed=37 k8 I$ ?+ t" R3 q
//背景颜色, k% [: F; E. @- Y9 B
var marqueebgcolor="#FFFFFF"+ B6 [5 `5 F3 l8 F% n/ \
//是否能暂停 (0=no. 1=yes)?9 w$ m2 `. b' [; T1 V' D- y# T
var pauseit=1
9 f, r$ K O( |7 x/ M5 [ \1 [1 j6 Z/ D2 E) f
//修改显示内容* r; R b9 f3 E7 E/ o. R, e
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" T/ j k1 q) P
3 E, d- i: d3 @9 ? d9 R I
: @& @8 g- E: Z7 I* ^
////下面不需改变////////////- F- N8 d' n5 B9 c
! O' M+ o$ Q, }- zvar copyspeed=marqueespeed
$ B( f5 }9 k- }. I! F$ b, @: zvar pausespeed=(pauseit==0)? copyspeed: 0) d) n9 w; V9 U0 u
var iedom=document.all||document.getElementById5 b. H; q3 L9 k7 M" Y
if (iedom); w) ~7 T" Y/ f0 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 i/ H) P/ j, g9 _- l; Kvar actualwidth='') s- a5 Y" D1 e
var cross_marquee, ns_marquee1 C5 B4 O/ {- i9 Q* Z7 A5 b1 J
1 x, i4 z9 T7 D% F7 ofunction populate(){, T: v# }3 s1 ?( G) l& y8 I" F
if (iedom){7 \9 Y* p. u1 K; p; C9 h( g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; A% G Y" c5 W1 Q3 E3 ?. i
cross_marquee.style.left=marqueewidth+89 B! k/ @ _7 n/ ?1 h- g- v
cross_marquee.innerHTML=marqueecontent
; c5 u% x/ \- D* l: ]6 S! M8 xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; N% ]5 |$ p2 _3 g$ ` \
}- a" ^- e1 A7 l3 [8 p3 R
else if (document.layers){
! y* o. q1 A6 ~ns_marquee=document.ns_marquee.document.ns_marquee2
- O/ N. i" B6 f+ f% Nns_marquee.left=marqueewidth+8' U4 @( ]& @3 `' q) r D$ |
ns_marquee.document.write(marqueecontent)" R( R. Z Y# R/ W
ns_marquee.document.close() v% G; W1 Y* }& o& L
actualwidth=ns_marquee.document.width
! k- @' k& ?+ @) L' c# Z8 P; y4 z; |}9 j/ F2 t' ]% n! ]
lefttime=setInterval("scrollmarquee()",20)! ~0 {% {( F" y3 R# n. ^
}+ ~$ m# ^0 ~1 A; M9 @, T
window.onload=populate0 [: a( {8 j9 y7 q4 P1 j E
3 O# w8 `* e6 X4 x8 w% G7 g# X' Cfunction scrollmarquee(){' W r9 C8 Z' ^$ h
if (iedom){
0 {! ]6 M; L2 `/ \7 a8 _, z0 @7 Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- O& J! \4 D h) I8 t& l3 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ M! Z% {; f2 K4 y& delse
- a% n, m* c' S/ Y" A# l" Jcross_marquee.style.left=marqueewidth+8
+ e9 L0 v& ^/ i5 E# c) j
3 g, t& x' L* a1 U; O( I}, t9 G7 R7 o5 R+ M1 {1 O! s: K, e' r V
else if (document.layers){% [$ j7 X/ Z: M6 C5 _
if (ns_marquee.left>(actualwidth*(-1)+8))7 C: h; G/ P: @: ?$ S2 b8 X+ g
ns_marquee.left-=copyspeed
0 S$ |0 x5 u9 ~else* M+ E8 M/ k6 h. I: N% E
ns_marquee.left=marqueewidth+8
* j" m7 X" h2 ~ v' X R7 Y}
( t* f- d2 h' k+ M1 D; r9 e( E/ W5 E}4 Q# L4 o! z+ ~& {- q
& w+ K! N. Y# X7 n( H3 Eif (iedom||document.layers){9 Z1 G- h$ m; [9 d
with (document){1 L N' _- B: Y2 H6 X" |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* D- H( y5 F/ i2 T2 I
if (iedom){3 z0 l; M$ {) A2 I1 C' k
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 K+ d7 g0 n2 T+ r& x, f% C, `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 b2 r; M1 z. Q. D5 Z3 a0 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: }+ | @. V5 ^2 G# i9 T* Vwrite('</div>')
9 F- [/ r. d4 S& A}6 W8 w# |8 |6 X/ P+ v3 H1 |" B
else if (document.layers){+ }: ~$ q$ W# o$ @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- }* y4 A3 }+ U. O {8 Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ n2 G0 Q+ N" G& xwrite('</ilayer>')/ n' y& M: P9 P2 n8 v1 S% ~
}
+ D5 P/ w' h) h; y) a$ Hdocument.write('</td></table>')
1 X$ _# o2 \0 K0 r' \3 C3 u}
% i8 {$ N2 e( v* f# H. s4 O}8 m" u- T6 T# B/ B9 g% z6 d
</script> |
|