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

|
网页之跑马灯文字特效
//修改宽度* p7 a5 }: P2 n
var marqueewidth=300
7 A- O8 z& g9 f* P& O) ~//高度
( w$ a$ V+ V+ V2 Xvar marqueeheight=25
2 H% }+ t I6 g+ {( Z2 e" o' _+ \0 ^//速度(1-10)
& @, T* n2 ~2 }, cvar marqueespeed=3
' u( {/ y% o: F, r5 i//背景颜色
9 j( G7 n2 q2 U, h& T" l. |var marqueebgcolor="#FFFFFF"
0 e( h6 i& E- A! o2 O8 w//是否能暂停 (0=no. 1=yes)?
3 F! s: d: D1 Y, }+ t0 hvar pauseit=1
. c3 a5 ` w1 [6 w) c ]8 T7 |% G2 a6 t
//修改显示内容1 ]8 l8 S! B6 w8 E$ Y. G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 T, P2 A/ p& V6 ?- K
o( n4 Q4 l( m8 i/ U; Z0 ?( I3 _ o( U1 _
////下面不需改变////////////7 J! H2 W1 o, j! ?9 w; ~2 Y1 i+ F
! i- T8 ~* W6 Tvar copyspeed=marqueespeed
: U/ u2 I9 S8 p3 X; |$ h0 pvar pausespeed=(pauseit==0)? copyspeed: 0
% z9 u+ J5 E- t) I& {9 V. cvar iedom=document.all||document.getElementById6 I8 D- E3 D( E- E0 G6 s
if (iedom)
$ C) o" l$ X8 s9 w: p3 S1 p0 m" J3 f6 Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" J; N! f4 i- y; i7 _) o+ M/ Q2 h1 M
var actualwidth=''! q, C* @$ l: _0 d0 q4 C
var cross_marquee, ns_marquee8 O9 n' f$ a8 m; P3 W
5 z! o. p- f& V# O) {$ Mfunction populate(){
; O' i7 {3 F7 H" e( U: F6 dif (iedom){0 D! O0 U* v+ m: U0 v9 w$ M- B: n1 g1 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 ]( `( O0 n8 ]9 @; S6 D6 k+ Ccross_marquee.style.left=marqueewidth+8
5 d( Z% [6 j+ Ccross_marquee.innerHTML=marqueecontent
) z- W5 G) g5 v- ?' l% gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 f; n( r: O# ]}( {* J% e2 l7 [8 T: _
else if (document.layers){% a! [1 y% c& s- @ ~3 f
ns_marquee=document.ns_marquee.document.ns_marquee22 U# m! {! }5 A: {
ns_marquee.left=marqueewidth+87 i" @1 _: _5 b r
ns_marquee.document.write(marqueecontent)% a$ }5 i z# z% o( J- B
ns_marquee.document.close()
v/ l/ N: f# Ractualwidth=ns_marquee.document.width3 [+ e$ D, s! |+ K$ X. x) r
}4 _1 R' U; g3 X z% O+ s7 R
lefttime=setInterval("scrollmarquee()",20)
; D& ]( U7 y5 p7 v2 k" c' }}7 c: e" I, D) Z. [6 ]" I X1 w
window.onload=populate# ]5 p [* z7 h
1 w1 L1 i/ X. h
function scrollmarquee(){
7 y/ G1 Q/ v' S0 `* T xif (iedom){ K4 ?0 c* w; D F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 o. w3 b& H$ O: s0 ?- ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; _4 v7 P$ n; ?' v/ V4 d' Gelse
, G) e; Q7 Y; _! Ycross_marquee.style.left=marqueewidth+8
; R3 Y/ a9 U. J$ B& r' }7 h! e
- k9 Y/ d! L) E9 u5 r}! i5 L- ?* m+ V2 u& y8 e- j5 k0 E
else if (document.layers){
1 F( u) g: n) z/ |! X( Aif (ns_marquee.left>(actualwidth*(-1)+8)): ]" ]! m/ n2 \$ O% \7 q: R: O
ns_marquee.left-=copyspeed+ G, A' b3 @! L9 e& E
else
$ V/ T( x) o2 `6 g% Hns_marquee.left=marqueewidth+8
2 m" w( A6 N) z! T. |# V}% {$ M! G5 E* X, F/ @3 U; D0 B/ X
}+ D& l% A( f+ V3 l- c# b; S
# d W" N. {- S6 C; o3 _" xif (iedom||document.layers){$ z2 |. w$ o' B6 ]
with (document){
1 p9 d6 G! z' N/ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- E; i% y; M4 c; | v" Mif (iedom){
: r& H$ B8 }1 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
~+ \5 Q4 F: r0 {- [write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ [- o* Z/ d9 }3 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 ]5 |' [# c6 u. x+ S) A9 v2 B
write('</div>'). y. l: U# V: e; F: f
} H7 B: a5 G9 {' @ N# r
else if (document.layers){- Z7 X) `+ L. x/ \* g6 X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ T1 G1 [: }& |* kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); g& G5 M" w1 N
write('</ilayer>')* Q# N! X4 }% Q. e" [
}
# ]; B; z% y+ X( Rdocument.write('</td></table>')
4 L, d- z" A# G2 J}7 f/ D! K3 W$ T" @( g* w
}
) i! _( e) q, ]</script> |
|