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

|
网页之跑马灯文字特效
//修改宽度
2 `1 M. `4 H9 T+ _- w7 X7 Jvar marqueewidth=3000 u# b0 v% ]( n* R5 @
//高度
M- ]1 a6 S. V [0 Jvar marqueeheight=257 Y" @3 r' l9 j9 L: E% q
//速度(1-10)6 D- j+ [: C5 X3 _4 Z7 V1 o
var marqueespeed=35 b5 y5 ^- {) H* j& K
//背景颜色
( Z$ `# o4 F3 o9 K* U i, Xvar marqueebgcolor="#FFFFFF"6 s- R, Q) w8 z7 p. ^0 h7 i" l
//是否能暂停 (0=no. 1=yes)?3 \$ Q' k4 @ B* [
var pauseit=1( d* \3 u. q$ A; x b3 Q
7 j8 l& M; V" h5 E* M//修改显示内容
8 F$ A6 E6 M3 W' w2 B. i& mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) ]8 H6 A$ o% z5 u) [! S+ R; y9 j+ f
\' }. K \4 q+ o
////下面不需改变////////////: k8 y! T0 { S# H* Q
4 [: i8 ]& Y% r) Z& @0 a5 U
var copyspeed=marqueespeed* n, `& ?% ?' H3 t
var pausespeed=(pauseit==0)? copyspeed: 0
" u" k+ o5 Q, }( O8 v r6 d8 Wvar iedom=document.all||document.getElementById
( I" D4 l6 I4 P2 V$ ]( {if (iedom)5 I1 A8 ^2 a$ I
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* M' ^, I0 b& T. _5 _3 s
var actualwidth='', p) M; |- o' ?! R, ~
var cross_marquee, ns_marquee5 {# u" q1 u) g
! M" Y( r: R, U8 d# I
function populate(){$ @! G/ C' ?: P, k6 U, D5 b6 T4 ?
if (iedom){+ Q {9 Q/ a0 B" `' G! a3 ], s. d- u B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* X# H9 f- K) l# O) T# ~
cross_marquee.style.left=marqueewidth+8
; f% M; T, V: Rcross_marquee.innerHTML=marqueecontent
/ |9 r# ]; L! S5 N- w- m, Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 R$ w! F" G+ |5 @( J/ j
}
1 D2 t$ f- v$ a( Q$ Y6 [% d9 V9 Lelse if (document.layers){
- M& C4 {- ~: C; H$ L+ S2 fns_marquee=document.ns_marquee.document.ns_marquee25 G* I3 S' S6 x2 b; E3 l
ns_marquee.left=marqueewidth+8
3 f1 |3 E, T8 H0 \! N( @ns_marquee.document.write(marqueecontent)
: D* @1 {2 H3 p* Ons_marquee.document.close()5 d! l5 j4 l% D
actualwidth=ns_marquee.document.width
8 I0 K B; [" Z+ b$ Z+ e4 n}! {% `, T# \6 m' l/ ]" x
lefttime=setInterval("scrollmarquee()",20)9 y5 s- W. F% s; S- x" \
}
5 G+ U. Z$ P: d4 Mwindow.onload=populate
9 |) U3 C* ^* P3 e
3 p X0 R& Z2 B/ t# Efunction scrollmarquee(){
% l# t8 x F( g0 h0 x* Pif (iedom){4 ?3 \- N& b% G$ M. H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ l+ G( \% Y" D+ j/ u% z M* `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: S8 o: s- M4 Y% u8 e7 j" j' F# M
else
- ~3 F6 J5 Q. M* x( x, Z8 o3 wcross_marquee.style.left=marqueewidth+8
' i5 o3 q# |; o3 v$ N5 }, b% J+ ^! C$ j% n; P' s& V2 m
}
' q; r1 u7 T- z! A! r5 selse if (document.layers){
. B' o; f& \; D( c _if (ns_marquee.left>(actualwidth*(-1)+8))
, R9 `7 L3 z$ qns_marquee.left-=copyspeed, y5 g s( t5 j4 V- I% ^
else' S2 d( l% w$ f$ H: V1 q! F8 @9 }
ns_marquee.left=marqueewidth+8
T1 }7 T, h% k8 c% l0 y}) ]# }$ E" f# a8 v! W! C
}
/ M+ |4 ]7 w6 y0 A4 [/ m, m
W/ e B! l( b0 A8 ?if (iedom||document.layers){. u4 x% y, q6 ?) {& T* }7 h
with (document){: m p9 c9 @/ B: y/ [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ [1 i' [2 Q: o2 i* n# R. O& u
if (iedom){
6 C3 L$ C7 l9 [& Q, Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) |; S: u6 Z- Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 C' M! L0 v R* ^; Q2 V5 k9 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ P( g+ u+ H" B5 h4 p) jwrite('</div>')
9 J1 W! \7 n G4 F}) O% M( H( I: a& H. N. z5 w7 A
else if (document.layers){
# n3 T$ E( _# R% ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: i4 K5 X9 e; _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). I/ x" U7 g' V5 j5 K2 o, J- W5 d
write('</ilayer>')
6 K* P1 y2 o/ U5 Z}8 r5 P8 U) f' y" o q! \. h# ^
document.write('</td></table>')8 J$ y8 R8 _; I
}
- g K$ b' D0 d, k4 a9 Z( a( Z}
/ B* O, `9 z1 T2 Q/ E6 J</script> |
|