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

|
网页之跑马灯文字特效
//修改宽度
( y k* W7 \$ j; L: c6 Hvar marqueewidth=300
7 d+ v8 F% e; p& P/ a//高度& Q) ^6 w5 {* V: c/ d6 J
var marqueeheight=25
# q& o3 K8 A) a; s; P//速度(1-10)
# Y8 r& Y! D" m6 t0 R" j/ A( k) Xvar marqueespeed=3
& F5 K+ J8 H# |+ S1 F//背景颜色6 D- q1 S6 { A1 J# e
var marqueebgcolor="#FFFFFF"
! P3 A0 v- l* g' a' d) P7 l//是否能暂停 (0=no. 1=yes)?- q0 D' s9 b7 e) ^# H7 \& P P0 s0 z* E
var pauseit=1
& S5 a+ U7 Q1 u: _% |5 S" U T- d7 c" y9 u: t) Z p1 k; |# _
//修改显示内容7 g7 t- H# Y4 ?" K) Z, w# f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 g$ |: |" k! j2 e5 ^; X" A3 w
2 F9 T+ j ]" G9 e4 {/ P# T
0 R7 H1 u8 u* C9 d/ [# j
////下面不需改变////////////
; t: n$ i% k6 X E, I, ]1 @* _
u4 i: {" l2 ]$ X$ [var copyspeed=marqueespeed+ ~7 M, V" j- t4 e5 [
var pausespeed=(pauseit==0)? copyspeed: 0
' W! w+ x; J$ O" d$ Ovar iedom=document.all||document.getElementById. A/ E2 P0 n) _6 q6 v
if (iedom)9 s5 R0 ^- V6 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& {1 A! ~) S+ yvar actualwidth='') q* a/ W$ Y+ n6 g
var cross_marquee, ns_marquee f; w) a% x' i+ A
6 ]% |' H6 P- z2 r$ s* ~
function populate(){: }: H& q) ?% P9 f' n7 {# l
if (iedom){
. n3 K0 ^0 j8 n' f' e" E% _- |& g ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! _8 z- H/ R' s$ l' [, L! _cross_marquee.style.left=marqueewidth+8
+ h y' ?$ \: D6 Xcross_marquee.innerHTML=marqueecontent
# C6 T$ k9 R# V0 @actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 T2 c& `7 n5 V; e2 J7 j5 C' e( X
}
4 d! Z5 Y0 ~ k" p& @else if (document.layers){
; D/ r( r6 K* a8 h, zns_marquee=document.ns_marquee.document.ns_marquee25 W1 ?( O& E! u# H9 D4 l
ns_marquee.left=marqueewidth+8' | O. j3 @: U( S3 a3 r
ns_marquee.document.write(marqueecontent)
5 v" k+ S/ [8 Fns_marquee.document.close()
9 p9 V6 S: Q- b) x7 cactualwidth=ns_marquee.document.width
; |8 n5 f, d7 T8 p! i- F}- m- W4 G) A9 Y C4 C% ?) _
lefttime=setInterval("scrollmarquee()",20)
" K T( v m6 x+ t3 o0 h, j}4 K, I* d9 U- w8 H2 Q" ~0 I0 l
window.onload=populate
: C7 v H) Z% b3 T: m
6 Q/ d, z q$ h: r0 n& Xfunction scrollmarquee(){1 ]3 Q6 i+ [7 C- l
if (iedom){4 Q4 t* {5 M6 m/ q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 y' X \! [+ b& S! ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ g k% a- z" t- Oelse5 S& I' \& w# U k/ `! W
cross_marquee.style.left=marqueewidth+8
1 U2 c4 }( ?* j1 P: D' e2 f+ U2 x# N( s8 j5 E; I# w
}, [, v) j$ C' `% M) d/ I* M, n
else if (document.layers){* G6 O; A# [ }2 `6 V; i
if (ns_marquee.left>(actualwidth*(-1)+8))
: X+ t: b9 {7 \7 Lns_marquee.left-=copyspeed* y2 F: I; v$ C& `
else
, i3 o9 V+ ?' U6 Wns_marquee.left=marqueewidth+8: h7 v' D' H2 H2 x3 W" y
}& N" E8 E8 Y0 [6 Q# u8 o
}& c; [' K2 Y+ b9 J
2 m* w$ N5 L R) f) _( }7 S: I
if (iedom||document.layers){
9 ]- s5 y. G+ iwith (document){4 C1 T/ b2 G; C) y& g6 p* _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) _' W4 w* u$ [5 {. c5 x& L
if (iedom){
: K# N/ y0 Q+ z2 T2 k! t. E5 dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 Y$ L% _$ L% K% k/ twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
a9 I: n! h; Y/ Q" [% W3 xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& W: f( [ o7 N( m! k0 a7 B* O/ y
write('</div>'). M- {% m' Q @1 T
}! N; H0 p) s9 Q, q9 k
else if (document.layers){
! J9 N% A: b$ C' }* Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 F" t8 i8 M2 x" M* F6 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; _0 B1 u8 d& `' J/ Zwrite('</ilayer>')
( V! P7 F* G" K: p. Q/ o; _}- \- C; X5 n7 {) ^. N
document.write('</td></table>')
3 |. T! P# G1 R0 e# X! ~}
5 M3 m9 G2 H e& A; _}
4 s5 W* C7 t) r; y N% p; S</script> |
|