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

|
网页之跑马灯文字特效
//修改宽度
3 N2 ]8 }8 i# k0 h: ?var marqueewidth=300+ C& ~ c. Y, |1 E3 C8 ~- y
//高度; S; j8 `, A% [! t$ |9 n) z
var marqueeheight=25
8 L6 |5 w& n. U9 ]//速度(1-10)
5 }+ f2 v! j! |& E' m/ evar marqueespeed=3
. J. R/ J: h; ]' F* {//背景颜色/ j6 o. e7 `/ q# r, ^6 g7 ^# T3 K
var marqueebgcolor="#FFFFFF"
) T5 S( o5 L8 e5 x# _# T5 n//是否能暂停 (0=no. 1=yes)?
; d0 R1 I6 ]; ^/ a& g' ]# B# ^( C# zvar pauseit=1 w" [, S9 ^$ _4 d( t
, ^6 t5 I. g3 I1 n0 |! ^1 T//修改显示内容7 E( U8 P8 F: l( E' j, }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 B: \# y6 N& q, E& r! x
) X3 D* I* h) L) J
4 n% m0 A& t2 S5 N0 ~) P# l
////下面不需改变////////////3 k" p5 T5 R* O+ B
, J: Q }' }6 ~1 G/ c- y5 N3 A; r5 _var copyspeed=marqueespeed
0 Q' G( d* j& g0 {* U* K# e! E/ S4 Nvar pausespeed=(pauseit==0)? copyspeed: 0& A( l6 ?- ?, U& \& k! _. ?4 ?- k' r
var iedom=document.all||document.getElementById
- D1 _0 @% B$ e$ Iif (iedom)) @; c& k' s. I4 |0 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 R7 T! i; s( e
var actualwidth=''
8 L+ }) P& v2 M# W2 gvar cross_marquee, ns_marquee
' s" j* U& a# s* w1 N' r1 }+ X8 v! U3 U8 ?2 R1 i" W6 W( P
function populate(){9 g" H T% H& S P
if (iedom){5 h, _' z# m0 v% s- j6 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 Q; M7 o* ^7 |/ T* o" f0 Ccross_marquee.style.left=marqueewidth+8
' E( K3 u/ U' J. z, v4 c$ V, gcross_marquee.innerHTML=marqueecontent' i* q+ f+ N4 s! Y( A3 B+ w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; }& m7 Y- D# l C' S h. e}
/ ~) E4 I* r" ^) K0 h) o5 W0 Melse if (document.layers){
; S2 Q& b" |+ x, w' Hns_marquee=document.ns_marquee.document.ns_marquee2
- p! J, o# p5 x# M4 s/ F0 r) X8 _ns_marquee.left=marqueewidth+8
9 y& o9 O( [1 K6 Q) z# ^ns_marquee.document.write(marqueecontent)! d- D7 Z( Q/ e* a, V [& L4 b
ns_marquee.document.close()
/ C- f9 v7 g0 Z" B+ ]9 Pactualwidth=ns_marquee.document.width
4 }# _# Z) U6 J* @( {$ k \6 Z/ a}* W+ L' \. g8 X# L- V; q2 O
lefttime=setInterval("scrollmarquee()",20)
" w+ |+ X: O1 A, S+ [% I" o* {}
$ E' k& Y. t# i0 D8 Z2 ^window.onload=populate$ `- k7 V, [: U4 s' {8 C9 u
! c# [; o. k2 ~7 Yfunction scrollmarquee(){
; I1 |$ l+ z( P6 O ]if (iedom){
8 C- N1 Y3 q' z3 o0 K+ Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): p7 o* ^# D2 I$ k, A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 v4 I( s# v9 o# |5 u5 T
else- i3 x5 _% G7 A
cross_marquee.style.left=marqueewidth+8
+ j8 m0 r; t$ a) p0 r! ~4 w. G) v7 }+ X5 O8 [ i# K
}
' P+ Z, p% f, O- F# |' C- ]else if (document.layers){- i' k; k5 ]8 k9 _
if (ns_marquee.left>(actualwidth*(-1)+8))8 W S& \. Q }" z1 {0 y8 r% S' f
ns_marquee.left-=copyspeed
( _# s: j+ y4 G, d' xelse) F. }, i$ F4 U( }
ns_marquee.left=marqueewidth+8
+ m; k; `: s+ } y+ y}
: A& E# f' ?# K}
- c1 q8 e) z) k* `
! O( p2 E7 S8 W6 R" F( v9 `if (iedom||document.layers){
% P( S% F9 F$ D% W5 ]with (document){0 t/ ~& y- o3 y8 M- o/ G) \: n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 F# N# \" N( A$ }4 `if (iedom){
" t/ B; b( h0 I% d) C, pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 \3 f) t ^6 k1 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; ^& ]6 S% Y/ `. a' T xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% x# u4 Z& ?& L
write('</div>')
7 T% N0 t* r0 f% B# G9 f}
$ q) }# ~3 _0 [# n2 }" Y* belse if (document.layers){
: t% n) X% E0 G* g dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 ]2 g% X3 x2 D
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 o$ ^# w8 A1 x5 ?8 h9 ?' }write('</ilayer>')
% o; h& h% R1 E/ ^ P, J( W}$ I3 l6 d# M: G/ c* S# A* G
document.write('</td></table>'). Q+ z6 X- q2 f1 k8 i. m
}3 Z% J+ y# L5 G! Z7 X: l) ?5 \
}
5 T/ r- Y/ f- ~ m& }</script> |
|