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

|
网页之跑马灯文字特效
//修改宽度
' @4 Q, I# f# ~" {$ Dvar marqueewidth=3004 Q. g* I6 t% P9 V
//高度' t- t; y9 r# q/ q& E. \. k) ?9 t
var marqueeheight=25 r- u [. Q0 B9 c) Y9 D
//速度(1-10)
/ ^8 c$ a+ A2 X5 \! Nvar marqueespeed=3
' G$ \; V$ P @6 d; v1 M//背景颜色
& ?8 F0 F8 @3 g( ?! S3 U. k; Ovar marqueebgcolor="#FFFFFF"6 q- ?3 N. Y- G+ @
//是否能暂停 (0=no. 1=yes)?
4 O J1 @) c+ m8 w9 N8 wvar pauseit=1
. i4 G) l; `4 d& L6 S) d& z, o1 d
$ ~3 D+ L$ b: A$ l* ^) S//修改显示内容% d5 ?4 ^% W( n, B$ M" Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* S! p1 [+ m/ d+ r1 N# e0 R
0 B% ?. F8 i5 y/ i# ~0 L, D
8 @! w' m# G0 c////下面不需改变////////////( P0 g; j% r& y, ^
" W$ ?7 I1 O, ?0 M! D- tvar copyspeed=marqueespeed3 V! e0 f. _9 u3 _" G: u
var pausespeed=(pauseit==0)? copyspeed: 0
A' f3 c) U$ }8 q) o- \var iedom=document.all||document.getElementById( {' u& N# r& ^# P( b3 i" D, C* u
if (iedom)! a+ @4 c( Y9 f/ B8 A0 `, u3 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); e2 U% p+ j+ c
var actualwidth=''
& \6 Y1 `1 p3 V2 T# }var cross_marquee, ns_marquee
3 r0 \/ N* x! ~2 j- K+ x7 o* ]4 r: o7 h) O
function populate(){
* V9 F! ~- E# l- w6 t; O& eif (iedom){
( B! F! D- ?' ?9 `. K2 `9 Y# {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 K: s: J7 O% m5 G0 @
cross_marquee.style.left=marqueewidth+81 U- O, L- R' b7 p
cross_marquee.innerHTML=marqueecontent
8 |2 q; @; w: E% Y/ B1 |3 pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% Q3 q1 ]9 E* A% U/ v}. E* i/ p" p' X$ E. k& M
else if (document.layers){
: ^( Q* B, }! ?# _ns_marquee=document.ns_marquee.document.ns_marquee2
& o' j7 Q0 I6 z- t- e, b& g" `( ^ns_marquee.left=marqueewidth+8- f8 k7 L9 z8 n/ J x' d
ns_marquee.document.write(marqueecontent); z8 U7 c0 R( e3 }
ns_marquee.document.close()9 }7 O/ v- `) X" Z/ @) c
actualwidth=ns_marquee.document.width
8 m; i- e9 |2 ?# g g}
" v% i0 E* t, [lefttime=setInterval("scrollmarquee()",20)
8 Y* Y# w% e6 r8 I}4 ~- G1 U& y" T! Q$ Q. Y
window.onload=populate" Z( x U2 u' }- ]+ ~2 c
6 O6 ?, @% h9 R' Y- ^0 \
function scrollmarquee(){
1 U6 Y, n0 w/ y+ uif (iedom){
' m# \) E" A# v1 ?& @ b% i! rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* h3 t! C, X& P/ across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ s7 Q* r/ R$ |$ H/ p" M, m/ y
else) S. U: p5 ~. J$ h3 q
cross_marquee.style.left=marqueewidth+8
: s: j+ a8 j2 @0 T8 }# S0 i: v8 I8 x3 Z, |
}' p4 b! h$ n# Z: u- h
else if (document.layers){
1 N$ f! e7 P* V* R7 u8 k: i/ Dif (ns_marquee.left>(actualwidth*(-1)+8))# x1 T' X& ]+ V2 y. j
ns_marquee.left-=copyspeed2 W, U( L5 F0 W, a% {' B8 n9 r. b9 @
else* ~$ R1 S2 k/ L* ?
ns_marquee.left=marqueewidth+8
6 u) n5 B8 Z' {* @' |# W! |}) P+ w% ]8 W: `" P# B
}2 y! v% C5 G9 p2 p
' N# r% c9 i' ?7 t& A) Zif (iedom||document.layers){/ e) i! \) x. Q+ W! V/ U3 S
with (document){4 [/ u5 ^- v2 b2 l: _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, Q: H: ~4 V7 T: M. |if (iedom){4 ~( z# ]$ t# P, M7 m$ q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& V; ?8 D( Z1 V, c# X# p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 }4 L: j7 `6 _* {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- I0 X2 J# q/ [, b/ gwrite('</div>')
, L6 u3 Q9 d: i# d* f4 O}
' ]9 Y' I0 v" I( m3 O8 i1 ^else if (document.layers){3 D \7 j$ P+ a9 D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') j% N1 u% T6 A. Q3 g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* s' d! e6 x8 Twrite('</ilayer>')* o3 E" G* k, P9 ]! L4 o) U
}
) I1 O1 W, O7 @" u- C* k! s- k- [document.write('</td></table>')
$ f+ C+ [* d9 f/ h# G; N5 a}
; m# _6 W% `: H% N! i}
3 y. ?, X$ a+ j. ?</script> |
|