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

|
网页之跑马灯文字特效
//修改宽度
6 K b. r* o% yvar marqueewidth=300
3 u4 V0 z9 y$ c* Z) j! \' {2 |//高度
' g6 D0 a9 ]7 S; e7 k, X \! \var marqueeheight=25
. C6 Y" `* M8 D) F x H- X- @2 Q0 e//速度(1-10)
Z1 K: L" s+ T: W+ Nvar marqueespeed=3- C p3 S/ |; n. V" _
//背景颜色/ x8 _9 f8 {/ Y2 c7 Q- [5 a1 T
var marqueebgcolor="#FFFFFF"
) {3 q8 y I6 u9 Y0 }, t//是否能暂停 (0=no. 1=yes)?
1 y$ m6 ]7 a, \- Mvar pauseit=1+ [* ^- f. y7 A. l5 ]1 N) S
1 n; |! s5 o5 D; Q
//修改显示内容; P0 T. h- T) s# w: x1 ~9 U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 w/ a6 d, ?6 y; X; @# o# i& c: ~3 Y/ @/ Q `
- Y% D; G/ f7 A
////下面不需改变////////////
; z5 |9 Q. @& [2 e3 t+ _: x3 Q
4 ]+ _. V9 ~2 M) Evar copyspeed=marqueespeed" T* D; @% s6 h+ W9 q8 v. u
var pausespeed=(pauseit==0)? copyspeed: 0$ j' i2 ]5 P5 h# w, Y5 Z4 a
var iedom=document.all||document.getElementById
: Y+ k7 o) T2 l/ Jif (iedom)
, R& E$ A8 U9 _' c" U4 B, C: ?' Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ }& `( P5 m1 O5 s& }5 Y# k, \var actualwidth=''' a8 r- l0 Y* m- V) A/ X: v
var cross_marquee, ns_marquee# E( C# ?2 u! n; t
9 d6 m9 v3 H3 H- _1 \
function populate(){6 \7 E+ Y8 m; f( W4 ?
if (iedom){8 D) R* @+ O3 {4 z! J# E1 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& n+ H+ \6 G' T( f6 h" Ocross_marquee.style.left=marqueewidth+8' I, ]1 Y% P' M" a; F5 a1 J& B
cross_marquee.innerHTML=marqueecontent
" |9 `. C6 s$ ^1 Mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; g' X6 D" _. I7 M2 O: U}
5 b7 G, ]$ f% i1 D# Nelse if (document.layers){; u* n n6 ~& z
ns_marquee=document.ns_marquee.document.ns_marquee23 Q9 ~. F' v T5 {; k( l8 i
ns_marquee.left=marqueewidth+8/ E0 O' x f' b' A" R6 e& L. y
ns_marquee.document.write(marqueecontent)) b$ Z* C6 M! d' G) D
ns_marquee.document.close()! g: ]) P9 ~5 c' H
actualwidth=ns_marquee.document.width0 C j* d( @$ k2 \& s$ ?# V4 w7 ^
}
, D- U/ S, i Glefttime=setInterval("scrollmarquee()",20)1 X& } l/ C' F$ |6 S" e3 s
}! j' {8 T" b4 H3 k; X+ i$ {% v
window.onload=populate, G" E# _5 T, j
0 w$ X( U! Y$ R9 a; U
function scrollmarquee(){
: j7 R8 J; d7 q: R! iif (iedom){9 C) c2 U0 o6 M9 q( v/ O1 l* b9 c0 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* ^+ F; ~0 ~3 p" C3 L4 z, ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
}; N3 r# ?7 g5 |) |else" O3 G3 a# d9 }; L/ v
cross_marquee.style.left=marqueewidth+87 x0 l0 e2 I7 d) e! @+ c# E
# Y+ n- _; |" d- G& a a
}
2 U; |, p* h% Z) I0 P& ]$ [else if (document.layers){
* [5 Y) S$ e1 z3 ~4 aif (ns_marquee.left>(actualwidth*(-1)+8))
" { I8 E; o% c6 Ans_marquee.left-=copyspeed" y" \, m# e. W4 k+ V7 G4 U
else
9 r j r2 y: u3 n/ q$ Nns_marquee.left=marqueewidth+8
5 y6 }( k! b1 F" X. a/ f}
$ E3 v$ M, _5 W* o! W}
& b( r* V6 H$ q# ?; U6 b) B0 y) b! \3 ^8 S6 U
if (iedom||document.layers){
/ j, z" W' e8 Z' G2 q8 q y. Fwith (document){
' r3 Y7 J4 R0 N& }2 [0 V+ U/ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 A0 V* W' I# q
if (iedom){% x$ D, ]/ q" E' b3 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 P2 Z, e/ U& b' }$ q, |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 I, C& Y+ u; l5 p; v( t' D' H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 a4 r! E9 p8 Q& t, P5 E0 ewrite('</div>')
% {* v0 }7 Y+ s3 _' a}
9 l: Q7 O, d6 h& {1 s# x: selse if (document.layers){
/ n2 D, a3 L, j# L: d9 t0 pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 m( F. `) Y& q0 @" r- ~2 E' L9 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" G# I$ o5 \* r V& z
write('</ilayer>')
5 I6 A5 g S& ^% {$ E. ^}
2 J4 n6 C) w/ I6 A, ?document.write('</td></table>'): x! z @+ J* l6 N) [
}
. B* W: O2 g# | X}+ U" U0 {. i8 A( y; Y
</script> |
|