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

|
网页之跑马灯文字特效
//修改宽度' d; y8 f8 u/ T+ ~
var marqueewidth=300
. H+ h: a) D6 L2 D6 i//高度- z9 Y) Z6 e0 b
var marqueeheight=25% n+ l7 R- V1 F* d7 J1 r
//速度(1-10)8 }, {1 s3 Z4 J" I% v9 F
var marqueespeed=3
1 q# _0 H( s5 Q3 L! E$ x- X//背景颜色
0 N& d% H& Q$ E( a8 o% _3 Kvar marqueebgcolor="#FFFFFF"
, }2 K9 W4 V5 M7 u//是否能暂停 (0=no. 1=yes)?
) O1 _5 W) F4 d0 A9 t7 svar pauseit=17 ]0 G( h8 y' c% R
6 |7 F3 P& u6 O. A: ^//修改显示内容
& [2 H0 [5 L$ X0 ?! S2 D! M6 qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. f, I+ N: F, R6 O# K& M
8 I8 g/ K7 G8 k1 @
8 R$ z' N* o% G7 w% ]////下面不需改变////////////5 [/ H. _ c' X# u; U7 P
/ j, e( Z8 e8 k) z! a9 Q# uvar copyspeed=marqueespeed
" h) v5 j, u+ n1 V* k! Nvar pausespeed=(pauseit==0)? copyspeed: 0
- u+ ?9 |0 ^! } [! m9 Zvar iedom=document.all||document.getElementById2 p2 A7 _: J" s( e2 T
if (iedom)
0 s4 h4 X8 U( r6 E2 O( @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). f2 g; h% z: w" Q# A. _
var actualwidth=''- k; i3 ` V8 R7 ]' p! w
var cross_marquee, ns_marquee4 Q& G# ^- U- y
1 a$ @3 V& U/ D$ `' J/ }$ I$ _4 Y# c2 Dfunction populate(){
v% f9 @5 X/ R5 V# ]if (iedom){
" c. s4 y7 }9 {0 D5 `7 Y& gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! R- `) C! G- \. S8 L) ?- u# e
cross_marquee.style.left=marqueewidth+8# |% h3 l$ O: s: h; |) j- `
cross_marquee.innerHTML=marqueecontent
3 w; Z$ \8 A% l Z4 m7 z8 Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 ~3 o* W% }! X, a. q, N0 X. P
}
1 E& P" n: \3 T% L+ Q. w9 I- g5 eelse if (document.layers){
7 \6 x9 R# w, m u* Wns_marquee=document.ns_marquee.document.ns_marquee2" K, v9 N* I, R2 }
ns_marquee.left=marqueewidth+8) S5 e3 w3 a5 e% ^3 |
ns_marquee.document.write(marqueecontent)+ E' F! |; s+ Y' ^+ C
ns_marquee.document.close()
4 P( [2 h- D- x i9 M: ~actualwidth=ns_marquee.document.width
' J! n9 z4 }' B9 f6 {}
) P5 q2 b- y& u+ [2 r4 b8 T9 |- llefttime=setInterval("scrollmarquee()",20)
# V: u: Q( O, K7 t3 i* d$ b) Y+ e+ f}
" ^ P- C* e( C; p7 |: @8 L1 Zwindow.onload=populate1 D1 G* ~7 [" l
0 I3 g) l+ B0 \" W1 r5 M {1 @
function scrollmarquee(){
8 {3 l8 L, R/ {- _8 x9 mif (iedom){, s$ G7 J* \- h2 I" y" P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 g7 j1 i- w* f J% J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) p, q" K0 n1 d$ @6 D! V& Gelse
, J$ l! Q% _9 z* p/ Ncross_marquee.style.left=marqueewidth+8
* A& F }# W% |; a- a$ P
: v' t; B/ D; J}( y, Z. V5 Q# j! V# X& o7 r
else if (document.layers){
5 E+ R: c0 e/ U( w2 p' v. j3 g% sif (ns_marquee.left>(actualwidth*(-1)+8))
; ?1 C W. y: E7 {% Yns_marquee.left-=copyspeed8 L. m! o4 w1 O$ G4 @' O
else9 I* u5 X W; Y3 `* ^& m
ns_marquee.left=marqueewidth+81 J' {) j: H: N- x
}
6 ^! @3 ?, N6 @6 S) l}
7 F" _. J7 f5 i" [" j- |- K3 K f( y" ^5 q0 I/ K: _' Q
if (iedom||document.layers){5 I9 N% X8 {. o5 _! o+ B; z! Z1 j
with (document){
4 a, i# B- o4 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# S9 a+ O9 L9 I1 X/ Lif (iedom){
( ~% U) g( F; h, h" [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 ]. y2 o- |* [# ~/ @) q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ l5 ?. t. S4 l$ A! P# G( Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 `. r. R) r' t' G2 }write('</div>')4 Q0 W* S/ x$ |, K6 e' e
}
! S% E8 R: O& Yelse if (document.layers){) y. N3 Z: L& M8 c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ a0 o* e2 T9 f. D8 J: d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 q9 R9 [0 ~! U% V( o, Ywrite('</ilayer>')$ _/ ~8 Y- H7 A6 N& m( J
}( f ~9 _8 P, D0 P7 @! n
document.write('</td></table>')
# h4 g3 x+ k9 S$ _5 `2 ^2 X}4 C' w0 h$ J1 T
}
8 m) k7 ]( p# a5 Q+ V</script> |
|