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

|
网页之跑马灯文字特效
//修改宽度
1 T" }( J5 m9 R; y3 ~var marqueewidth=300 w/ C( X* f9 P9 I8 j) z( T( Y, ~
//高度
: h# c- f, s' u2 Cvar marqueeheight=25
) @& C7 u3 L, f//速度(1-10)
2 V+ ~3 A) d; p& \' g9 W+ ivar marqueespeed=3
1 d; c, Q* s3 |: D$ M1 r" K. e, [; o) a//背景颜色
/ y, C1 r q ^$ F' Nvar marqueebgcolor="#FFFFFF"" |9 H) o4 L3 y) J
//是否能暂停 (0=no. 1=yes)?" \: e; {9 C" P. f+ ^3 Q
var pauseit=1 n) i0 k `/ j4 j
3 i4 D0 j. W2 l! _0 p$ Y//修改显示内容) R8 k" c' Q8 _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 K+ Q2 y* z# y# a9 d t, h* \5 m. a: l$ \" S1 B5 @
1 Z- k5 M; |) m1 S& y& P% a1 M0 S
////下面不需改变////////////- e* ^8 W( u! s2 l
! B Y, T' Q. {& t, w& J/ M
var copyspeed=marqueespeed' W3 ~8 j& q: T: C
var pausespeed=(pauseit==0)? copyspeed: 02 E# I0 P' v: I1 _& K* ]
var iedom=document.all||document.getElementById
) z2 {$ @% t' Z6 F& Rif (iedom)
9 ?6 d% ?0 I9 z4 {- f C* `, \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 u; Y. U8 W& O1 y$ X! ~ i6 f3 Vvar actualwidth=''$ T( V7 x* u; W7 S! n: E
var cross_marquee, ns_marquee4 I- J1 N2 B+ K9 @4 {
" I% K& o5 e8 {0 ?
function populate(){3 `9 @/ u/ o3 n5 d5 \3 v4 B
if (iedom){
; y( {6 K3 t2 ~" o# e0 P- dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 s2 p: _5 A; A" b/ G3 q
cross_marquee.style.left=marqueewidth+83 S9 f( p& H9 e, L3 D3 C0 ?4 [8 v
cross_marquee.innerHTML=marqueecontent
, ~4 o# v# k: L o9 W mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& x* e0 U. ]1 C4 g9 |
}( ~2 O5 D+ {0 l& A) C: t8 F
else if (document.layers){
4 s% l6 }# j6 j% X# _ns_marquee=document.ns_marquee.document.ns_marquee2
- X! p7 X6 Z1 I0 o4 F; K: yns_marquee.left=marqueewidth+8; | H! {0 f: u. H5 v" k
ns_marquee.document.write(marqueecontent)( r" H% ]& H+ O% J: W4 S
ns_marquee.document.close()2 L% i* I- o9 F/ Y% D7 n
actualwidth=ns_marquee.document.width
! H' _% a, }. y}: K$ o6 ?, e" X8 }
lefttime=setInterval("scrollmarquee()",20): P% F3 K* }$ Y& J/ V8 [" d
}
* a+ T8 c( {7 W& H. @( Y. S5 Y4 Qwindow.onload=populate
# A+ S; U9 {8 S% ]5 q( E# E4 U
+ l8 v) q3 V8 W( g+ Z- U; jfunction scrollmarquee(){
" z1 J# u e3 |' {& ?: n' }if (iedom){
" o! k* D7 ~( S6 Q2 C: J0 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* e9 p! u; @5 M$ t2 Z, L4 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! r) k3 F* Q3 _- A9 f- Kelse, {% R2 |+ k3 p& {4 S* _2 f5 g
cross_marquee.style.left=marqueewidth+81 j2 j6 E2 F; I1 r9 h% y1 W$ ?
1 S; \: n& C1 L) k. ?9 E# E
}; m, q3 Q3 a7 `. o. ` M2 h* y X
else if (document.layers){6 V9 n- f" N/ ?
if (ns_marquee.left>(actualwidth*(-1)+8))
: p7 l3 r% X# Ins_marquee.left-=copyspeed/ z9 J! _4 o' D: X1 W1 K8 w/ T
else
. N: g I$ n' y$ F( G9 S! h$ \ns_marquee.left=marqueewidth+8
* ]- w7 K- Q! m# X# d}+ z$ {/ q3 Q* u& N# o; }
}2 H4 y. C/ M+ u( t/ V b" Z
* o1 v7 ~, I- k: p6 _: j( a2 g
if (iedom||document.layers){
1 V; `% Y; K1 X* b" zwith (document){
7 G! ]# y- F: ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 c+ c$ k- m; A
if (iedom){
( q) [6 T/ ~# P; H7 v1 C e4 q. b# [' Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 O/ r$ ]0 `7 _' S) O; Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' u* e6 k+ R8 l9 I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, q) J2 r) X. G. h2 w& {/ b7 Bwrite('</div>')
8 W" N; b1 b& p9 f1 d% j}
$ d: s& ~/ f) ]else if (document.layers){) o+ m7 ^ a) s% S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 _6 r" m. i8 Q7 r4 u7 P5 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- U/ D3 z4 p8 V" z6 ^
write('</ilayer>')5 q( \% ^# G, ]8 H, K
}
+ E& c+ M" c/ R0 D' [, H! ~6 Zdocument.write('</td></table>')
1 Y& f, v0 i" C; K7 L) l* m6 K}' i/ P, k' K- R6 V: y% q1 f" @ l
}
. l, `/ f! g7 X* {7 L</script> |
|