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

|
网页之跑马灯文字特效
//修改宽度+ c- G( U$ s5 v* u; }' j
var marqueewidth=300$ `! ~- d$ O g
//高度
9 Y6 V6 n+ W3 [5 c$ R$ U; m) h; {var marqueeheight=25- w% l9 O6 @# e2 {4 E
//速度(1-10)0 w1 m8 E0 D1 @2 i7 |# \
var marqueespeed=31 h+ l, a6 G; Y- q' o7 j# t8 n
//背景颜色
4 @" D! m& I4 A" X9 ?% O; Vvar marqueebgcolor="#FFFFFF"6 H" J. C$ f+ Y0 ~4 `
//是否能暂停 (0=no. 1=yes)?
0 H& `+ _/ \& i1 b {6 E8 Evar pauseit=1
' E$ X h3 z7 e3 o
0 }, |3 M1 M6 }" {/ q: N1 g& H//修改显示内容
1 h8 X0 O8 ~5 G- d avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 l& L& c6 w8 q/ U$ m& o6 ]" J& }) Y; g8 \; {- y& b
; D2 v7 t1 M: f2 {+ e
////下面不需改变////////////* O |6 R2 {6 w" |' A: T; N! v
0 ^( O: l# J! L( |+ s7 r! dvar copyspeed=marqueespeed
$ e, c: s9 D* q: J7 N, U; Kvar pausespeed=(pauseit==0)? copyspeed: 0
; g# i" r) ~% H @7 { fvar iedom=document.all||document.getElementById
/ O* U1 N( c) ?& j$ S N. q# qif (iedom)( F/ z) V& S$ N( m3 y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" U$ `% j [; ^" D! \9 ]
var actualwidth=''% [1 j6 [' w2 x1 x' B
var cross_marquee, ns_marquee: a6 }+ C1 H6 g0 t; b( F, |" Q T& u4 B
% W- b* _ L3 g
function populate(){
3 M* h/ P( l2 D3 [; }3 _if (iedom){5 ` C; _/ k! R' m4 `% }: I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' c; ^5 m' u. ~' scross_marquee.style.left=marqueewidth+82 O4 O1 O Y7 g8 i6 m; H0 C/ V- F3 p
cross_marquee.innerHTML=marqueecontent2 o4 v0 v* w% O+ d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 m! O. p* C& Q" W7 A) g}
5 e3 ^7 I) L4 E( uelse if (document.layers){
5 y* ~8 r w& U7 uns_marquee=document.ns_marquee.document.ns_marquee29 `: Y. o+ V4 r/ D5 B
ns_marquee.left=marqueewidth+8
}- U1 D8 t' C" C) ens_marquee.document.write(marqueecontent)1 Q; \. [( E! ]& \
ns_marquee.document.close()
; {9 n3 M. t7 ?4 p6 L* z2 i Sactualwidth=ns_marquee.document.width
" u& c! s4 ~+ V5 \7 v% ^- I3 N}
( U5 b% l/ _- Glefttime=setInterval("scrollmarquee()",20)
# u$ @6 W. G6 c( N" G T& G# g}* z: I: S6 h; D- C/ ]( |' _
window.onload=populate
. b- M( q1 d% G" H5 D! E# T# ?; m. F4 @. U; s$ r
function scrollmarquee(){
% n" ~- s* ~# Z9 ]3 K( v$ f% xif (iedom){ ^- F$ U) M, C4 d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* w9 V0 t* m. [. ]# V) }& bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed |( U, u& W/ f2 T1 Y
else( k1 v6 e- ^2 }2 s$ \4 d1 B
cross_marquee.style.left=marqueewidth+8
, y" o R; r1 B/ G' \. X9 t r. n/ w) Y/ ~; d& r) O6 Z+ g
}
% h% U' T4 Z, G' R0 i3 qelse if (document.layers){/ H! t I9 { D7 M
if (ns_marquee.left>(actualwidth*(-1)+8))
' S/ ]) T* |, z9 x+ q' O$ M; n v1 I' Cns_marquee.left-=copyspeed! Q/ a4 J# F9 n7 h0 U
else; D+ o' v" X; F2 @3 B' z
ns_marquee.left=marqueewidth+8# f; q* E, _1 \
}7 f0 l- {: H/ j" S1 L' e
}" K0 D% O% f8 p; E% g
2 z. d! v/ Z% b7 [+ p
if (iedom||document.layers){/ q% x/ s0 p+ U
with (document){, Y* L! T% |& ^+ K( p% U' ~' x
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 z/ j' o' }3 m& A9 M$ {
if (iedom){$ v# [. D9 J7 c+ L; T6 |+ R6 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 W+ o9 y2 F+ \9 C2 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- K1 ^6 J; K" M: N2 H2 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' Z) \. }2 W( e/ swrite('</div>')
0 S V3 M2 V- a# Z- U}
1 V" C3 ?5 H+ f/ a8 b( I- O5 velse if (document.layers){0 r4 I! }4 T4 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) F5 W& O, {, g/ V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 [ P: o2 C# r$ x+ Z
write('</ilayer>')
; q) V, y& Z( {$ T, n" a( {, L( T}
5 B4 J( _4 t3 T* q' m6 Vdocument.write('</td></table>')1 `" S. @* N' P/ i
}
6 D+ h. e5 K$ j* A# \' h$ A}
8 ?- f4 q0 \9 j# L</script> |
|