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

|
网页之跑马灯文字特效
//修改宽度
. y4 Y; a* H" d* u; |3 S" yvar marqueewidth=300$ X- J+ T/ c) b! D; s+ }+ @# z, t
//高度
$ M& A! Z5 J* Kvar marqueeheight=25
8 B4 G5 A: C* J. ^5 Y/ C9 g- m4 S. Q//速度(1-10): j: V/ m! f b( \, G! `1 j
var marqueespeed=31 v6 v* U# _ |
//背景颜色
5 y+ H5 |" ^0 R7 j- o6 I9 Wvar marqueebgcolor="#FFFFFF"4 ?4 a, ]% V2 ^. M
//是否能暂停 (0=no. 1=yes)? H {- e! O! O5 |
var pauseit=1* F# S% B5 Y3 | }- \% m9 S
1 o- b( ]: t, q( R7 H* T- b
//修改显示内容7 r T! R1 [; ]% ~: H' L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. M. R3 i' k: m8 X" g! F& d4 p" M; |
5 J" w3 x; W4 \; n5 O! J6 k, X& c4 @# t; `( ^9 x% x
////下面不需改变////////////
% w( ?/ i. d4 Q0 V8 _: M, @
; H! \% K2 `8 s* ?; ?var copyspeed=marqueespeed& z$ E! h, _1 f/ ?
var pausespeed=(pauseit==0)? copyspeed: 0
$ M+ K; e2 h A# Gvar iedom=document.all||document.getElementById2 ^/ V( V- ]3 C/ n& R& Q
if (iedom)) g) @! z/ m2 n5 |7 i% X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 ?* J- n* @8 A( xvar actualwidth=''
+ k6 n. ?7 T6 V; @# Vvar cross_marquee, ns_marquee) {3 h* T( j; }$ H* X$ Y0 Y
+ K. }! L; h3 A' y# [" |8 G% W
function populate(){
5 {5 {) u* P9 ~! O8 U. E qif (iedom){
% {- u( f' d0 R. M- s9 Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( i3 D5 o f5 ]! X5 h
cross_marquee.style.left=marqueewidth+8
/ A6 ^; S _5 [5 H+ Bcross_marquee.innerHTML=marqueecontent
; E. n9 J+ H; factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 ~ I, |% d9 i3 F) h
}7 e. @( P' y E# h
else if (document.layers){! X4 J. w. k/ [, p
ns_marquee=document.ns_marquee.document.ns_marquee2
8 k7 G' G& r) u4 z+ ^: o( q2 Nns_marquee.left=marqueewidth+8
9 d- L P9 }1 |" N* ons_marquee.document.write(marqueecontent)% i3 t) Q: l" F$ Q' E
ns_marquee.document.close()
) ?* b+ W' J" iactualwidth=ns_marquee.document.width
6 m6 }8 X- c* o7 I0 {! t}
, r5 u# P0 l' x; O4 W! \" slefttime=setInterval("scrollmarquee()",20)
* Y( {8 K0 b/ C) t}
" D( f+ _3 ~/ D2 `2 a* ?window.onload=populate
4 R2 a7 q: g8 B1 }2 z- q0 x' D7 g* g: @
function scrollmarquee(){
. t4 Q# O6 w% [0 t6 h9 wif (iedom){4 ~. h' q( m2 s- e! T. c0 A4 K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ o5 |# `( P+ l" o& k( Z1 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; z+ r- L9 v$ v, R- e& S/ W! Q
else6 W) w; u/ N4 O, {3 \
cross_marquee.style.left=marqueewidth+8
* K) V" @4 P* }. {! J E
- O! |" H# S) o( h2 ?}
3 x9 N5 w, U3 C1 }! |+ velse if (document.layers){/ J# k- e' Z2 M. D/ F
if (ns_marquee.left>(actualwidth*(-1)+8))
7 L- K8 `# C, S% Y# _& ~3 D1 Bns_marquee.left-=copyspeed
( U2 T; o/ h# [9 L% |* Relse
% }% K$ K. M" {+ a9 v' uns_marquee.left=marqueewidth+82 d( K$ ~ s2 s$ y- M4 Q
}
1 L* C# \% V5 q# Z1 q}5 a# E1 J8 Y; `; F3 T
8 M2 G- X! z: `0 ?7 xif (iedom||document.layers){
# l1 L. H% Q% N5 d8 P6 ^# {with (document){
" \0 m$ h6 h- ~5 z% \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), a7 W* D3 d3 X. |5 E4 `- q7 h
if (iedom){
# x4 ^: Z1 I7 a% Q6 ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
W6 ]2 b5 d7 Q* g; Y: cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 }9 p7 j/ n# j- ^% Q: |' @- m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# \" J# w3 |- ?( W% \# U. q1 ~; g
write('</div>')5 Z9 l6 | B- b4 q1 g: K
}
% l% c' i2 u# Z( {else if (document.layers){
6 I% [8 M- T. awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" }: a$ f v0 c1 y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 N& {+ B2 Q0 @+ A' E
write('</ilayer>')) X* z8 z% b( g% |9 F
}
" O v+ V6 a N8 odocument.write('</td></table>')
! Q4 `, I$ B$ P# M+ T6 Y}
& h/ K8 I1 j+ [7 D}
3 j J; g, i6 w( q</script> |
|