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

|
网页之跑马灯文字特效
//修改宽度
. Z% f+ |9 q0 r6 p$ v# o* i. jvar marqueewidth=300
@8 d! L0 q& N9 X: P6 |6 F J//高度# J' c R$ X6 Y) X2 Z+ G
var marqueeheight=25) U3 |' W5 Q6 S4 ?) ~% T
//速度(1-10)
* ?0 e+ _( M. Yvar marqueespeed=3# K$ R, J7 M- t+ ]9 l% K( \ U
//背景颜色
. Z# G; d# V8 Y$ |( `2 M* P- ~9 ~0 gvar marqueebgcolor="#FFFFFF"
# b* E8 q0 c: S% s; A//是否能暂停 (0=no. 1=yes)?
T6 ~" b* N# Q* ?7 I) W( Svar pauseit=1
6 k+ q) ~0 B$ C5 d r; ]5 h
; `; m1 D, |7 k. F0 V5 F8 ?//修改显示内容
$ P/ B$ _$ B! x7 \- b9 Z8 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: H3 u8 w# ~; o2 S7 ?) `8 M" [
! i1 o9 [- [# l/ t- k1 u9 `2 U2 X2 |+ q) [, q* ?' D p8 u
////下面不需改变////////////
5 c6 ]1 c3 p! ~: E3 Q5 Z( p) ~: o- @0 a) p% l! q
var copyspeed=marqueespeed
4 G- Z4 W1 @' Y8 g' Nvar pausespeed=(pauseit==0)? copyspeed: 05 [" F+ P# ?& P8 W, h! g$ {: y. K
var iedom=document.all||document.getElementById
. S' l X! j7 q" r3 k. |9 T" Hif (iedom)9 T" e* [6 r4 b* [ I3 k% T4 d) b0 u! o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' D8 D0 D- b& {- l
var actualwidth=''
! `5 {; _' h0 z# Z0 f7 h5 k8 P$ yvar cross_marquee, ns_marquee
1 }6 k: C5 u+ F) E& |+ _9 ]4 ~4 {' E* c( x1 J. K( H9 k6 v6 m$ B E& W
function populate(){3 s& [# T+ d/ h" M* T
if (iedom){9 b* z8 y5 N& U" q& C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ v# V E, R! h/ f! K: y# J! b6 V
cross_marquee.style.left=marqueewidth+8
0 A& |, K( u# [) b/ [cross_marquee.innerHTML=marqueecontent- H8 H( Q" j* h3 y t+ G0 v3 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, {1 K7 J/ a3 H/ u5 T' ?}
6 G3 u8 J3 k- \1 @4 k5 Xelse if (document.layers){
! F7 p8 v% r! H. e. Fns_marquee=document.ns_marquee.document.ns_marquee2" ]/ j0 l) ^6 q4 _6 c
ns_marquee.left=marqueewidth+8
0 A1 [9 H4 U' z+ m- k; j9 Hns_marquee.document.write(marqueecontent)
- `1 R$ h8 G1 F* `* q9 kns_marquee.document.close()! B7 k* s6 ] N/ F6 M3 K! e% B$ O' z
actualwidth=ns_marquee.document.width0 r7 z* z3 R0 X
}1 @8 I0 J. f- z' g- f! m
lefttime=setInterval("scrollmarquee()",20)
; n+ F% q, `' o8 k. {- p) i. L}
# c2 F5 v G: F8 A/ y2 o4 B$ Mwindow.onload=populate
! }1 W. N/ F5 j3 X3 |& z, v
9 @' c: K% O: a" D/ kfunction scrollmarquee(){7 k$ P/ u6 ~' z- R. q
if (iedom){
) o4 {& [/ _' d* O/ _2 z7 Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# a8 n6 y6 J* k, k+ k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; z! C1 v. y" g. D6 ~8 P
else
3 A9 E+ i( k0 d0 T& hcross_marquee.style.left=marqueewidth+8
2 z) I' S: `5 y
1 Z0 j( P, ]* \5 j; k/ Z* p) F}* c7 |* h. s+ J3 v& K1 C
else if (document.layers){+ _- q, S: u" S) R3 x4 d
if (ns_marquee.left>(actualwidth*(-1)+8))4 e4 r2 e4 u# F; ^
ns_marquee.left-=copyspeed
! g% n5 V# }7 T; M+ n! v( ^else
0 Z5 U3 E- t; t5 P8 `/ vns_marquee.left=marqueewidth+89 g, m9 n) g4 G4 o: \, a7 B$ g
}0 m3 Y2 H$ X3 x# H) \( L# d
}+ k1 e$ \- }. t6 e# Y" N) }
S7 {, I" m T; I* O4 c" M2 _* Zif (iedom||document.layers){ I: |. W/ Y" R4 H) X7 n* {! H6 a
with (document){" @. }( D* g9 ^3 [4 g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 d. I* j# H' F0 T3 _if (iedom){
2 D- |( G1 r2 Y+ x% Y6 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 x4 s( n" ]) T/ e4 {4 p$ c! i& i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 |7 a: a1 d: T0 q# u5 u' V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 K }4 s+ G0 {0 A2 i& @3 Twrite('</div>'). E/ _! F5 F; A" \. h, ]
}
0 I2 z8 ^) p- C3 K* ^8 g. x3 oelse if (document.layers){' J x ^3 S9 t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 A$ ~+ s, g" o8 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 `4 b% c: T. g9 U" i# l
write('</ilayer>')
7 J6 I, F; l% e& F5 |8 r) e: Y}
- O+ L5 N6 u/ I0 F l3 {document.write('</td></table>')% Z) m4 p- g4 p
}
& U- d4 T* h+ a% @3 ]1 u8 @}
+ L3 j, \3 _, |9 r</script> |
|