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

|
网页之跑马灯文字特效
//修改宽度
' n# h. z8 |) c9 evar marqueewidth=300- a& Z( I! h9 p( \" ^9 J
//高度$ Q. _! G9 T9 [, k
var marqueeheight=253 [/ x/ Q: d5 ?
//速度(1-10)
# j8 v1 @$ X) o$ s$ I" h, q( \var marqueespeed=3* U- i/ a8 V2 X/ n
//背景颜色3 @8 i' }7 W3 d/ Z- u
var marqueebgcolor="#FFFFFF"
+ l4 d7 e( D0 s9 x( g+ L. n//是否能暂停 (0=no. 1=yes)?
# P- R0 R! E9 x8 uvar pauseit=1
6 B; D. v" }% \6 m) d4 J$ R' _
6 u/ T: V( S! B5 r8 B//修改显示内容
4 p5 [6 W& a9 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ ]4 c9 t4 Q$ N% l: a k
8 ^7 a+ J2 r8 t
m' p! [3 q4 F% z1 x& x////下面不需改变////////////
) @* y+ p$ x }' j9 w
! x; Y0 J7 b0 q$ ~5 xvar copyspeed=marqueespeed5 q! C) W4 A0 a9 P$ Q2 ]" S
var pausespeed=(pauseit==0)? copyspeed: 0# B/ ~' U8 F. B( d
var iedom=document.all||document.getElementById
- a1 F# H3 k4 ?( X& ]2 gif (iedom)
2 B1 E m, O$ O- \( S' wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 J$ o9 z" b# K) Y) A# W4 Mvar actualwidth='') S+ h4 f) z: J/ v5 S; R/ e
var cross_marquee, ns_marquee, e; k6 }: f+ V8 T1 I9 E
, v( o5 D; q3 }! y, l3 {. nfunction populate(){! J4 \; C7 k" S, j* t% v! N1 y0 V
if (iedom){
2 @. w' }4 q+ j8 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 ]. h4 M0 l( \1 [cross_marquee.style.left=marqueewidth+8, V' f- j) K; q' e6 t% V! q9 F
cross_marquee.innerHTML=marqueecontent
/ O0 J4 _6 z( W9 |( U4 nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! j: G' h% K- T% |' c' {
}
- e5 [# A0 o/ u _/ Aelse if (document.layers){
6 p% f5 M# p; P1 E. `- j- Yns_marquee=document.ns_marquee.document.ns_marquee2
- ~( o6 d |6 Ons_marquee.left=marqueewidth+8+ n# L5 n: C8 ~0 g" g, n) J6 G
ns_marquee.document.write(marqueecontent)& w$ x0 |, L* R+ N$ Y8 F" I; i6 A
ns_marquee.document.close()
6 f8 h R. w+ \ @8 uactualwidth=ns_marquee.document.width
- F. @8 r. d9 d% _3 H; r}
3 T& w/ T( h0 d7 G# Mlefttime=setInterval("scrollmarquee()",20)
* z4 Q9 Q) L# e, |5 t}
9 y- i4 z9 T; e2 C; r- ywindow.onload=populate" w7 C: x3 C+ ~8 M+ r7 E
3 l: d! Y4 ^. j% ^5 v1 c
function scrollmarquee(){
) Q4 i- z8 x; B8 W$ Hif (iedom){
2 |' `. }& n+ `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 s9 l: s: ^+ o/ I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed u& |2 Q) u+ ?8 ?$ a+ b5 A% [
else. [- {" {# e8 E. o
cross_marquee.style.left=marqueewidth+80 D7 W' _& t$ u5 E1 \# }5 @- s, V; z
# ?* h5 m5 m" a( _" d! M
}
7 t; [1 }3 ?' j9 |' h2 Q% @else if (document.layers){
! _' P1 @+ D0 h$ ?$ Nif (ns_marquee.left>(actualwidth*(-1)+8))
6 ^+ O. C3 F! x4 e# Xns_marquee.left-=copyspeed7 }9 E/ n* W6 }/ ~- [
else
O" o3 E: M5 A( Ins_marquee.left=marqueewidth+8' t+ ^# T5 G( w& X& U
}
. P7 W" W. }6 Q7 C) u}
4 C6 k8 D4 i9 w. `
, e# L0 m6 g6 y! Vif (iedom||document.layers){) f# R+ `# _ [
with (document){% X" Q: t) N$ h+ K/ q& U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- A9 @/ h3 c" H7 a# k, T/ F2 j
if (iedom){
0 k9 H' |2 G& |" Z3 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& Z( o( J6 [- w5 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): _- F2 ]( w+ b* W+ O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* m: L; P! _. P& W+ v. r3 wwrite('</div>')( Y+ f: ?& C2 A" l% }5 R X% w$ [
}* q( [- J! ?9 j' y/ |
else if (document.layers){) t1 E( p( x z1 W Z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 e! Y1 w8 m( N/ x1 H. _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 `* j1 D$ ^7 U$ ~) Xwrite('</ilayer>')
; ^6 v) u: o1 r5 _}
8 Z) }+ [$ f+ u5 `! K7 D8 k" D- i/ Udocument.write('</td></table>')
8 R3 b1 k9 a( \& M6 M9 y} u' h+ ~. X% A. Q* Q
}
9 o, Z7 b4 t" l3 h7 q</script> |
|