返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& L" a4 f2 c* k0 o3 c. w4 v, uvar marqueewidth=300
. H. r3 A. N0 y% }8 d//高度
4 K0 p. v) h7 T8 Tvar marqueeheight=25
% T4 H/ L: W& K/ |( G2 O//速度(1-10)) a. h; @% F: `# a
var marqueespeed=3
: i' U  M6 I8 Z9 ~) s/ v& H//背景颜色
8 J/ V8 v. y: H1 t$ C- Vvar marqueebgcolor="#FFFFFF"  E& |2 ^5 u# `7 N
//是否能暂停 (0=no. 1=yes)?
: r; X" I; Z  h- {var pauseit=19 ^9 ]' L3 n- w( o

: A5 P4 Z) D6 O6 x8 J3 q//修改显示内容/ R2 Z5 e# q5 Q. d! N0 I
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% E3 m; N% f. x  O- _0 J0 ]1 Z: B

7 Q4 q1 g0 J, P  y
: |+ S8 s4 x& i0 b////下面不需改变////////////' w: X# a3 h$ k) P9 Y8 l: F& u

. h" u0 A; |% K2 u; cvar copyspeed=marqueespeed
- U0 k# X, V. ?# {3 yvar pausespeed=(pauseit==0)? copyspeed: 0
& I- H1 O8 J- z; w& e/ Y0 jvar iedom=document.all||document.getElementById
1 A$ x# z/ _9 \& l. ~% _# I/ D: D  eif (iedom)
8 y  d/ r1 a! c$ V6 zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); R; ^6 B5 K% _# u- q7 o
var actualwidth=''+ h9 O4 G+ ]! A6 I4 D4 u8 [8 K9 a
var cross_marquee, ns_marquee
+ I1 h: ^- ?2 I4 a7 z/ q
& ~0 |+ O/ ?2 _+ v1 m# v* C. jfunction populate(){/ C5 H1 H$ _- Z* C/ P
if (iedom){- Z  N6 w: W; [1 K  g% u5 P! {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 c  `; G9 Q. h4 O+ ~' C8 q- E
cross_marquee.style.left=marqueewidth+8
$ E& Y8 M$ e& B, d4 vcross_marquee.innerHTML=marqueecontent% e7 v2 z8 u5 F9 j6 B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ L! K  [  P- A$ T+ a0 C}. w: t  W; k9 d  a% ~% l! x& W' ]1 x
else if (document.layers){
; \, k' d8 }5 C9 O; E% }$ _ns_marquee=document.ns_marquee.document.ns_marquee27 b- u+ q; V( J
ns_marquee.left=marqueewidth+8$ v! A  u  _0 q
ns_marquee.document.write(marqueecontent)% \# D  ~  f4 p6 W8 J% p
ns_marquee.document.close()/ ?) A; J! @( F: x
actualwidth=ns_marquee.document.width9 u4 G3 ~( ?8 @" v$ Z* n1 ]# [
}$ S, a9 q( e( r
lefttime=setInterval("scrollmarquee()",20)$ W  ~0 Z. I; l" Y
}
2 d- t/ O5 p0 ?2 K: e2 Hwindow.onload=populate( @9 ~; A8 g$ q1 x  _' d3 z
0 p2 |/ l- S7 K
function scrollmarquee(){
! x; G' v8 C+ Qif (iedom){& V5 F0 v2 z* y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 w! G7 w9 h" `; G+ b" k# gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 A) G1 C* }, p# Q' kelse
% I* f, E( q% \' \7 M. s' A- dcross_marquee.style.left=marqueewidth+86 r, A8 [0 s# k. t* @, |8 U; z

7 O* s+ {5 |, G4 U( d: F+ _; d}1 U9 Y5 @* k1 Y3 D+ B' U9 a
else if (document.layers){
( a  M' G( E* Y" S0 ?8 [7 u6 J1 L: @if (ns_marquee.left>(actualwidth*(-1)+8))
2 T# l4 {5 a% }1 i, W& dns_marquee.left-=copyspeed; e) G# l+ Y; f. Q( J. e! r
else$ W! Y" K5 E& W* a. Y  ^
ns_marquee.left=marqueewidth+8
1 d3 h' Q1 Q) {- g) {: `6 @* r2 ^}! C4 C. L# c* P
}
, H! \% u( Q' T% S6 R# c% z: F1 I3 I. I: O! P! {8 E
if (iedom||document.layers){6 p% _; s5 Q' k9 K9 Z2 I9 O+ w, f
with (document){
4 {2 @5 ]" S8 S% C6 ?0 G% [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 @% Z  u: q2 T0 n" r6 k5 e+ v7 g3 z8 {
if (iedom){
( e8 @. t" J$ J2 bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 O2 @9 ^& V/ O% P% Q6 L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 S% c! L. T8 D' ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 l4 P3 \9 c2 }. `' Q$ ]7 u
write('</div>')2 j7 ]3 d( M8 K# o7 ?0 f. F8 J. Z' V
}
9 g7 W( ^) o- z: h- q0 P/ }  G7 Helse if (document.layers){* B% N& k! f; h4 `/ g/ l* x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 |! z" p" J' n3 [, U( F3 b' F% Y& [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, Z" G+ Z$ Y; z8 A3 B, p$ Kwrite('</ilayer>')/ t1 }0 A- F9 }! t  y, r
}8 Y+ s: b# m8 T5 p; D. U& L% N
document.write('</td></table>')$ A% ^0 `" L  n. g
}
% e! p& y+ q1 K2 d! n( Z& z2 O. e}0 q- N  `  J# f/ y. e
</script>

返回列表
【捌玖网络】已经运行: