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

|
网页之跑马灯文字特效
//修改宽度
1 e. C4 u% L1 H+ n2 \var marqueewidth=300
+ y6 s4 \6 ]1 i7 Y* b: T' j1 ~//高度
0 v& Z T9 M2 N5 t O8 pvar marqueeheight=25
3 g; _/ q/ y0 v" S- f0 b2 p//速度(1-10)
5 u2 s6 o" Y& q. U5 p% Fvar marqueespeed=3, E; p9 d5 j% o* k( `+ o7 S5 q
//背景颜色- D% k7 K) O1 e8 S: A- F! c
var marqueebgcolor="#FFFFFF"- N7 J1 i1 \' }3 S* e5 {
//是否能暂停 (0=no. 1=yes)?
3 O* O6 ?, V0 X# g' o5 ovar pauseit=1. j( B7 `! d0 M; \0 a" }* w
# Z/ S {$ j6 |1 T& |3 h/ Z
//修改显示内容& I- p( N5 F1 C" i8 E/ m4 w8 W U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ D2 d3 S: ^& R8 L% g# u, z6 i$ J, v8 k/ P0 w. p* I2 |$ ?
9 ^- N( w" F# h+ t; z* X
////下面不需改变////////////
, @; s& j: b8 J3 Y& {# }* ] \0 }6 D* U( ?: J
var copyspeed=marqueespeed- L# q; l, R) N- l
var pausespeed=(pauseit==0)? copyspeed: 0
/ G/ r/ D5 A" L' Yvar iedom=document.all||document.getElementById& v: o8 j1 A+ V/ S
if (iedom)4 M1 R) i' H8 D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ ~: T& X/ T% _5 f* n' V
var actualwidth=''
& \3 w( j* P8 K5 I- _5 cvar cross_marquee, ns_marquee: _- w3 s9 \- s, z
! R4 b# j4 k9 u' a9 A- o* P. {function populate(){
1 W( E( J2 g0 B6 }3 @4 t6 e0 Wif (iedom){
% ?. m0 x, o( o8 V3 a. \% n' E$ rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: K# t0 `- Y! m. hcross_marquee.style.left=marqueewidth+8
( a5 }5 u4 P0 O' ]% x! t4 \8 p( P, pcross_marquee.innerHTML=marqueecontent# ^1 X5 b& g# q% p, H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( w9 H3 W0 a, a/ o
}
7 i; J1 F" ^- ]4 }else if (document.layers){
K0 T% t( n1 |" H3 pns_marquee=document.ns_marquee.document.ns_marquee2
3 P/ z* l. ]! @+ m$ dns_marquee.left=marqueewidth+8" `7 t" q+ x. k4 l- V9 t, w
ns_marquee.document.write(marqueecontent)
& |$ q4 e, Y3 d% y8 o: mns_marquee.document.close()7 Z+ ^% d) A5 g: P" ^5 e1 l
actualwidth=ns_marquee.document.width
- i' w. p3 L+ G. C r: s( _}
4 Q* k* V% F7 ^1 G3 mlefttime=setInterval("scrollmarquee()",20)
2 M8 d' x- c7 p' v( M6 ~0 K0 W* C}0 G9 t, p! e# O4 ^' U8 @+ `0 U
window.onload=populate
9 g0 o/ t$ d9 o- I7 M- z3 q k- Q6 S, i: S; |
function scrollmarquee(){
: M; N+ Z* N9 {7 p: h+ K' |" c" _if (iedom){
$ h) \$ N9 |" rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& o- M1 N- C! G8 \$ a! Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& f1 r5 h1 a; L; }else! C$ f' j3 V8 H; X1 {. f
cross_marquee.style.left=marqueewidth+8, j! c. r& d3 b2 A
# w) I( z& g8 z4 j" T. C( S# v}) l% k& g2 f+ V$ B& ?* c
else if (document.layers){- B9 z6 |: \. K4 M2 N
if (ns_marquee.left>(actualwidth*(-1)+8))/ t3 ^. d8 P" K0 m
ns_marquee.left-=copyspeed
( K" |% Y& j* \, helse+ |3 `+ G: l& z4 N
ns_marquee.left=marqueewidth+8
7 ? _$ [7 |$ z}
: t9 J+ ]! |6 u8 }}; H1 q; K0 a0 \( u1 V. ^+ f
! C( j; ]1 L! Q: y: I* G, w2 tif (iedom||document.layers){% J9 r. \. o8 Y4 B9 H
with (document){
A# O' Y: q- @4 E7 Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) \) G/ x0 q0 `* cif (iedom){2 Y5 ^: J' @6 F" }4 \( a& s: y$ m( _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 I( R0 E$ d$ C/ q6 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ h+ W' \) ?; i! \3 [7 L) c5 Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ J2 b) r$ l- Y5 h
write('</div>')' C8 u* R* B* D7 @5 y& t5 z7 E
}) }+ w: G& S3 \4 D8 [1 \! I
else if (document.layers){
! O) t0 v7 \$ ^3 W/ O8 R" }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 ]4 {% D, t6 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, |) P8 f6 t. N' Q# i! A( b& Awrite('</ilayer>')* }) M. C& p* [, _2 t& o& `
}
* k# K1 N$ @! _document.write('</td></table>')
" J2 d. X$ J: L: D4 f S6 R: G# `}. u8 Y0 u; ?2 z. B6 F; n
}2 |/ z3 Q/ Q, r0 i
</script> |
|