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

|
网页之跑马灯文字特效
//修改宽度
" o6 h" n' |" ]4 j& ivar marqueewidth=300
4 X/ R: A! q. q$ U5 c5 Q/ {//高度; l9 [+ u4 A; s
var marqueeheight=256 H! `# `' g' g
//速度(1-10)
' J( G4 |2 A4 }& h- w6 h7 j! Mvar marqueespeed=3
0 n1 H0 f/ J* n; {7 H2 a//背景颜色
- D G$ ~! i: F5 m% t; e7 @( j X5 ?var marqueebgcolor="#FFFFFF"
8 `& V1 N! F- @# j' D//是否能暂停 (0=no. 1=yes)?
0 ~1 W. Y, F! S; j. y8 Nvar pauseit=1
/ y, T. v$ g; z* Z7 K! m6 ^6 i. N$ L1 _, u7 w: v8 j
//修改显示内容+ E6 W1 P. Q! v, e: g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- H- |2 d8 d2 o( a# [1 e% x# H% ~8 r9 g7 D" t2 }
' m1 e6 T6 K+ p; g5 Y////下面不需改变////////////
* G& [/ I h) z3 d# X* p2 [" Z1 U: z( r/ x
var copyspeed=marqueespeed: {2 C2 k3 e5 V( h% s Z
var pausespeed=(pauseit==0)? copyspeed: 0
7 v! s. I5 u& B# uvar iedom=document.all||document.getElementById) s* x2 Y( x/ q9 v
if (iedom)
+ D4 h5 g! D4 {# x, U/ _4 Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: x) n. T/ P* }4 g4 bvar actualwidth=''% u* q( E1 a( [3 m/ x% t1 w/ C" c
var cross_marquee, ns_marquee
" u; S$ \6 v" Z3 U0 ]) h( D% k8 _6 ~9 W4 r {3 I% }& W. L1 m
function populate(){! c! ~" Z3 q9 v
if (iedom){" b6 q2 D; I8 L8 D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- n, O" ]: g6 Z0 U* L( jcross_marquee.style.left=marqueewidth+8
+ C/ f& \/ k- Lcross_marquee.innerHTML=marqueecontent! y5 d$ T8 E8 j6 a8 v2 n9 \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# X6 }1 b) c; K5 c8 j) s+ i! z}
6 a. m2 N9 [4 Z$ a: {. F8 h0 I0 z" b: \else if (document.layers){; Y1 u5 v/ g% y( a- b$ V+ R, n
ns_marquee=document.ns_marquee.document.ns_marquee2+ M* s) ~2 z# T5 f6 G3 D" F+ [3 z
ns_marquee.left=marqueewidth+85 G9 ~) |/ J5 Z3 g
ns_marquee.document.write(marqueecontent)+ d7 N, D( e6 _: U) }% j
ns_marquee.document.close(): n6 A+ \: i% [2 Z
actualwidth=ns_marquee.document.width! S9 x. R! p' F
}
/ w: A+ I' N& M4 Olefttime=setInterval("scrollmarquee()",20)
( a3 Q- a' E- O- J' d- `+ t}
8 T6 O" L; T% C. S) l9 ]window.onload=populate
2 g3 X- Q! ]5 w. O/ B9 E
B+ E" _+ V; ]" t; H+ _function scrollmarquee(){6 u0 E) W; b( N; n
if (iedom){& H2 a0 x. I( j! }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 q( H3 R6 Q0 h: D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ e6 z7 M8 c$ u1 R z9 d1 G- A
else8 c ^. V% _# V" \' P5 r! E
cross_marquee.style.left=marqueewidth+8' J+ J2 T4 c9 P( u! J( ?8 v& Q
# c2 E0 {3 Z- Q7 k
}
: h& {# w% N: Z3 ~- U. l% Belse if (document.layers){
% R9 N& K1 C6 T+ c' D+ Iif (ns_marquee.left>(actualwidth*(-1)+8))9 U) V2 }! }5 E: r; O9 p8 ]
ns_marquee.left-=copyspeed
. `, O! ~. j$ qelse
/ v3 C1 \7 O" z" U; B! q& M' gns_marquee.left=marqueewidth+8
3 ^# C" Y$ H: W5 C. @}7 A1 [ a5 |9 Y/ ]) {' \
}
5 `% X8 x; ]# k4 K% P6 A" k1 s3 T; X- J3 m, t
if (iedom||document.layers){ F9 g0 z( ~% t/ v
with (document){
( y/ l5 q5 `; P {, d+ Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& ?: Z1 b+ g& c
if (iedom){
3 m5 z! n+ A! e' {% H3 t8 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; L9 b8 M# q& J0 Q; X$ d, V0 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ ^; I- |: R; c2 ~2 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. F6 w* a0 G( {3 R4 F! ^write('</div>')1 L1 U4 X4 k2 Y5 o3 h: J. s3 e
}
4 ?6 _8 p* g# ^2 v. Welse if (document.layers){1 `- a2 Z2 N: v9 }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% D4 a/ c5 e8 |7 ^; Y6 @: K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- @. E2 `; ]8 r E' {5 m
write('</ilayer>')9 c; N$ d4 \; }
}1 s2 \% B# Q) W t
document.write('</td></table>')
& t/ C! j+ c& C; J% c" A$ ]- X}* A0 U. g8 r# _% M7 Q
}
" H* x7 r2 l t</script> |
|