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

|
网页之跑马灯文字特效
//修改宽度/ p1 w4 Y+ I1 A
var marqueewidth=300% k# o/ p0 ], f+ K! z. E
//高度
, \# `; f% R3 z: F4 I' Y) Nvar marqueeheight=25
% Z, R; Y6 T3 G7 n/ [3 m//速度(1-10)
4 ?* `+ ~ X Cvar marqueespeed=3
) [# f3 e' V6 E//背景颜色
9 v4 b+ y, Q7 S# y' k6 E; Ivar marqueebgcolor="#FFFFFF"& r4 H/ m7 b3 d! A# P5 m
//是否能暂停 (0=no. 1=yes)?
3 ~( S6 `# Z2 Q( H! A7 L) nvar pauseit=1! P! \/ t8 X7 O4 X
; l) D; @! v" B4 L//修改显示内容
- |' \. Y3 m2 T1 V" H1 Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! c9 n9 u& j0 ?2 K. J- k/ z8 X" H4 {! o9 l8 R
( b/ S$ t# u' t
////下面不需改变////////////
8 s" f+ j2 s9 y/ ^% T7 F: P d* \5 ?& ~1 J& R
var copyspeed=marqueespeed4 f, Y* T) o7 E5 V+ C9 I! {$ s
var pausespeed=(pauseit==0)? copyspeed: 0! u) ^6 a% D `5 C9 |: i8 R/ R, l _
var iedom=document.all||document.getElementById
( @0 W# S4 y% Y5 ~# Nif (iedom)( l5 G0 `% K( \+ [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 C% d$ k% f' u5 `: [8 @! W
var actualwidth=''
7 {7 d8 Q. b/ u0 {! Ovar cross_marquee, ns_marquee8 [' V8 ~: J$ `$ M
- @. q7 R: Y g9 j& [: p; W( @
function populate(){
9 H* y" s" z0 h" Tif (iedom){, b9 \% k, g+ _- Y. Q4 a5 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, k- w, a" Q! j$ K
cross_marquee.style.left=marqueewidth+80 P( ?9 w; q6 D4 `1 P
cross_marquee.innerHTML=marqueecontent8 M$ I, d7 D4 G7 a; y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 u5 m* t' X( U4 n* Y4 {
}
3 r. @$ B. i" _% q# V f# Velse if (document.layers){
4 ?4 R* b! {3 lns_marquee=document.ns_marquee.document.ns_marquee2
$ S: S% E; P' d3 P9 p* Jns_marquee.left=marqueewidth+80 v1 X9 }- i5 T1 ?0 O/ k1 w
ns_marquee.document.write(marqueecontent)
/ a* n2 c, s h* r% y/ ens_marquee.document.close()
$ z' h# L8 h$ K: a4 |0 {0 H ]2 Qactualwidth=ns_marquee.document.width
/ S0 Z' Q6 ^3 L' U}
: ?" j: b0 r8 n% [lefttime=setInterval("scrollmarquee()",20), H# f A9 H% B
}
; Y& m$ @5 ]: a" U% Qwindow.onload=populate% R5 ^" D z. i/ R5 }' }4 R( N" Q
0 h) I/ V6 f- j0 ifunction scrollmarquee(){7 `! P7 l# I. ^6 A% f
if (iedom){
( b& v' }; b, ^& yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" z! b$ J# p0 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* q* `9 \* q. Q! [& r' \ l& k9 |else
# n+ F( `" Q: e' _; U+ m+ vcross_marquee.style.left=marqueewidth+82 c/ D/ d* N( a7 R0 Z
4 Q% B' z+ i0 B3 a; b3 Y$ @}
0 X& J, Z* W( V2 Gelse if (document.layers){
& Y9 P- a4 M+ K7 L: l3 Cif (ns_marquee.left>(actualwidth*(-1)+8))
3 \, {& P8 P" }2 T% n% W; ens_marquee.left-=copyspeed8 D8 s- H/ U1 H. f8 v; s
else
# T( o/ M; r) O. E. P. yns_marquee.left=marqueewidth+89 h8 i* q' S5 t4 e7 j
}
$ z9 Q, m1 D3 p5 j/ i9 A+ ? L}
% u3 I5 G# A4 T6 _+ {0 z! B2 T9 b
2 P1 D# S% X- ^# Bif (iedom||document.layers){$ @2 a6 E" r+ }% g" D( {
with (document){
; @6 ]2 M2 X; L! L' x4 Y/ Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* S4 d9 _/ Z/ hif (iedom){
# l' D2 b8 R9 t% F# @! {$ u1 l3 \$ A) pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 } X- o, B8 f. I' @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" m9 q7 ], s4 d3 k$ h) j1 ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" U8 q% Z6 C1 h% Z* P f; v
write('</div>')8 r: X8 O) A/ |# V6 z
}: S4 U7 ~( L/ q- t
else if (document.layers){
) B8 o* [* K# o) V; ^! b/ [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 S. t' ~; i9 B: S' O, G/ M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 ^$ f$ h7 q' U
write('</ilayer>')
g$ F1 ]2 G" t" s6 z$ I}
5 u2 ~* C* V @document.write('</td></table>'). d4 o! `6 }! ?$ K4 ^
}# T4 j) A9 w) D+ J& p
}
; g) ~' D C/ j7 p e</script> |
|