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

|
网页之跑马灯文字特效
//修改宽度
5 `; u. G8 I! e1 H' B$ Xvar marqueewidth=3004 X5 C! n& x; }2 h$ R+ E b
//高度0 x7 b/ A* O b) E
var marqueeheight=25
1 Y5 t) M" P! l5 w7 D8 n& b//速度(1-10)) N5 Z6 a( J' [
var marqueespeed=3& C# [8 D/ n' O: M/ ]/ q N
//背景颜色" D4 E3 V# @4 Z" k2 H5 H7 k
var marqueebgcolor="#FFFFFF"- c9 X# A4 W& N
//是否能暂停 (0=no. 1=yes)?
0 p$ e; {6 u6 { [* Z0 B" J" b, R! yvar pauseit=1
" t$ G- | _1 b, v4 F: |5 M8 r" W
//修改显示内容
, m6 g. x) m4 c7 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 R( r4 ?, A, N) n" C; i* G1 }% u2 v2 G$ x7 f/ Z" E3 G1 G
+ g" z& O$ x& w
////下面不需改变////////////
) i2 M9 d$ Y* n0 w6 m% r4 c1 d! }2 m, p4 @
var copyspeed=marqueespeed" Z0 M. `7 } ?* V( v, j6 b
var pausespeed=(pauseit==0)? copyspeed: 0
V0 a( r- _4 Avar iedom=document.all||document.getElementById
' U+ M9 g! k1 H I8 _if (iedom)) }" m- v; e' {. S2 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 u! A" {3 q- B# o$ l* J4 u7 r4 S
var actualwidth=''
" p3 l8 A8 F5 }9 f/ K* D' P7 Uvar cross_marquee, ns_marquee: ]" N9 e! q5 h; Y6 o* m
2 e& H L+ V5 n6 W! O
function populate(){5 }& _; N! b1 \, O
if (iedom){4 ~5 k5 V% y( \4 a/ }$ ]7 C, T# `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# U, M) N, a, U9 {) P9 ^cross_marquee.style.left=marqueewidth+8
* U2 G# R; f6 ^, T$ Vcross_marquee.innerHTML=marqueecontent+ _7 ^) u# f4 R8 f0 e3 v4 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 T) b2 {& ^" s+ n- n5 y9 A0 c$ c}4 B8 {3 P+ | E G5 G
else if (document.layers){2 g' z3 _% o x3 R* Q7 o
ns_marquee=document.ns_marquee.document.ns_marquee20 W% \& K& L" \
ns_marquee.left=marqueewidth+8
& y! r, O0 U, uns_marquee.document.write(marqueecontent)/ p' N* k: B3 n% z: ^- g" C
ns_marquee.document.close()
# X( Q6 W. q! ?actualwidth=ns_marquee.document.width B% t/ I" i+ B0 v2 t
}4 x( E+ q0 | |. x, ^9 w
lefttime=setInterval("scrollmarquee()",20)$ f4 [7 a8 b. l, e; t
}
. Q2 t& x# W# Y$ R* jwindow.onload=populate: D6 L T, y7 J$ S$ l8 u% I
- M$ J$ j4 H& hfunction scrollmarquee(){
' z3 d0 N% j0 c! `* p9 @' ?if (iedom){
q ]. Z4 z O3 v7 h' wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 ^ E" P& @ b0 X: L6 H* Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' n$ ?9 {6 J; yelse
* k2 z- b9 C+ W; Mcross_marquee.style.left=marqueewidth+8
% h! n, i2 A3 F' z: L! Q+ p. ?( \9 `. f, \9 }
}) g/ e( b4 q* J6 Z* T
else if (document.layers){+ d! V' ?* v9 L4 Z" G: g: b n, Z
if (ns_marquee.left>(actualwidth*(-1)+8)): o- X6 Y( T3 r9 e. j6 n
ns_marquee.left-=copyspeed7 }6 a3 s+ l9 [9 ^
else
$ A- {+ A0 Z8 S5 [ e- Fns_marquee.left=marqueewidth+8
' V& ^. N% m: o% S6 t}5 C1 r, {6 Q* a6 F5 W
}2 D; q& G6 f7 J) E0 h* N( }
! |* k/ `5 b8 x( \' ?! R
if (iedom||document.layers){2 n! w% `8 b& `$ i
with (document){# R9 k1 V; J( l# _* @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- s S8 Y2 I, F" _ P* Vif (iedom){0 F* ~& y6 L: |# g9 a- B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ L8 ?$ u" O* I, M: g- m2 Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 e% G% e5 J$ S5 @0 S7 M+ e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* r7 ~9 ?* y; {write('</div>')
- {' v- V; n7 b# { ]}" ^2 q5 Y) f2 I
else if (document.layers){# W3 i' |+ t8 _% z' q0 Z* p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& S6 f' A" q9 W0 u9 ?. O% Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: j- G7 I* R& Cwrite('</ilayer>')& _) K8 G( A- A" v7 S
}. g0 A5 j8 |4 ^* D
document.write('</td></table>')
6 _! N+ z0 K' g& J! w! N: k) ?}
+ D( ]+ g" ?6 s9 l& ]}! H+ b3 | j" f1 F/ ?. w
</script> |
|