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

|
网页之跑马灯文字特效
//修改宽度* Y" L/ P( g' \' J& O% ?; \
var marqueewidth=300 Z n9 ~# s' C! K# ?( u5 f* ^
//高度" H0 p3 v1 Q/ d
var marqueeheight=25( P9 p- _; b' a+ R4 y9 g
//速度(1-10)
3 a3 ~ y% c' y4 N. G! yvar marqueespeed=3
! @+ h& ?9 n/ }6 j3 e//背景颜色
1 e) y# Y3 C; m" F& ovar marqueebgcolor="#FFFFFF"; Q( d9 @; @# ~
//是否能暂停 (0=no. 1=yes)?
& Y2 J- p+ K1 v: xvar pauseit=1
. R; p5 X" H: S7 o. a
$ \7 N" c7 o5 F) O6 I//修改显示内容
- o$ N9 W M4 E9 k. ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 `7 r/ V) b; h/ ]
& u; [- F* P/ P( u/ D
4 s% y4 |( f+ S r3 w. q
////下面不需改变////////////( ]( L2 w! j! ~! h z
/ \# P1 e6 I: R( F& R' mvar copyspeed=marqueespeed
; a4 Z2 m- a5 |, Q/ f6 K0 kvar pausespeed=(pauseit==0)? copyspeed: 0
* ]+ o; \% L0 x: ?) ]% cvar iedom=document.all||document.getElementById9 R8 K! L. A, t) S1 `: T+ a5 `' ]
if (iedom)
% a9 q4 j h/ @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 F0 P* V1 t! i; X& s$ yvar actualwidth=''5 a, R7 ~) u! w! B
var cross_marquee, ns_marquee
9 i& a3 G. C7 G9 f( q1 r) Q* k
function populate(){
' U+ }) D) W" Lif (iedom){! o9 D. Q' C6 W$ L( x! p# ~8 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 Y, |- s$ r3 R2 T4 Y4 h' ocross_marquee.style.left=marqueewidth+8
: w1 r/ h* ~! s( ~+ p- L9 q2 S3 @( Hcross_marquee.innerHTML=marqueecontent: m* l3 u( `' A0 [6 m& }& a) |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 x* w) U5 P3 F2 Y! ]& G
}
4 T% E7 T" J5 j' r- delse if (document.layers){
4 ?& d3 L7 c6 F8 T* r8 y8 a3 D. fns_marquee=document.ns_marquee.document.ns_marquee2
& e3 m- i( o6 `. Rns_marquee.left=marqueewidth+8& x F% g* w# q* N7 B* Z
ns_marquee.document.write(marqueecontent)
/ l# M7 s+ v1 L% g( z6 c5 Rns_marquee.document.close()8 t1 }) ?! E; ~
actualwidth=ns_marquee.document.width
4 W8 z# n% I2 a. l- k, |}, o B9 ?1 ~3 N0 D
lefttime=setInterval("scrollmarquee()",20)) h/ E/ q: m- [2 r' q
}/ m( e' u! T) x L2 g, S
window.onload=populate/ X/ [! w4 ^) h; a
6 R6 @/ w8 @8 n+ c! A
function scrollmarquee(){6 }* m& W2 T; q5 r) L. W
if (iedom){
" e. Q, u% Q5 v; ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( J; A* a0 e' @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 |9 H4 K, X9 |- {! c( O* K
else- u1 Y: i' ^ D0 |) f5 Z$ u" O* y
cross_marquee.style.left=marqueewidth+8
- R1 Z5 {& {/ F( R! V& ~2 r* F
# A* v7 D0 c* f0 \}
) u% ~$ x: e. }5 W4 xelse if (document.layers){7 v- U1 n- }/ K" D+ H
if (ns_marquee.left>(actualwidth*(-1)+8))- k, F- n) r7 {; j( Q9 S) A) l- I
ns_marquee.left-=copyspeed
8 @1 P7 g4 e+ Xelse
2 |7 |! N' ?4 ]ns_marquee.left=marqueewidth+80 ~- |+ m1 _4 R) ~& \
}
3 B3 v0 o; Z$ @' {, b% v/ n}
8 t3 H }* ]5 W6 V' ^4 i: q- _: v/ @3 B: r: A, V5 M, u
if (iedom||document.layers){$ q3 e) h, B- I; O+ m' C+ w/ R$ k: t
with (document){
3 @, g1 ~7 n. Q* z# u. T. xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
U9 |9 h8 }0 r+ H1 B8 ^if (iedom){
# b7 s1 h! r2 A5 C+ a+ ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 d% M7 e" A/ [( y( ~7 h5 l; }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! L1 v9 |5 ] t; V* N% P0 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, ^$ l/ T5 t3 ~0 @write('</div>')0 c% j3 k2 n: \- t
}
1 _( g7 j' g' j3 D' C1 lelse if (document.layers){
6 n3 L4 l9 s L3 owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 {$ `$ i9 l# s+ n, h! Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ i" i$ K6 s$ Z$ ~, ^
write('</ilayer>'), c2 F. }7 Y( a
}
5 R; F, Q" R% A8 M7 B6 ~$ Ldocument.write('</td></table>')
) E8 p( o' u6 n {- Z' X* U/ I}
- v9 j. F- k- [) H# u! B}, p- Y% P$ Q! m8 x* j. |0 l
</script> |
|