获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度, ^. U, I6 p9 }' y
var marqueewidth=300
( C2 `) p0 B! ~//高度
" ]5 T) Z) g2 n' m# mvar marqueeheight=25
0 a- p, }3 X8 T) l//速度(1-10)3 o9 L8 v* T6 z! N# K( S1 F
var marqueespeed=3+ |+ P' k  z7 m% h- _1 o5 A
//背景颜色) b, K0 C2 Z- o6 L8 p, X
var marqueebgcolor="#FFFFFF"8 H$ j. t" U3 V( I% o+ I! O
//是否能暂停 (0=no. 1=yes)?
0 k% u5 ^* K$ S9 }var pauseit=1/ o2 p: J6 G9 E

6 q" e' t9 i$ J  [//修改显示内容) z. w' p5 k1 W* w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( v# x5 s; ~- t4 G
7 j# x9 c1 L9 `# l: i
0 }; |5 w' {" G: H
////下面不需改变////////////+ R5 V7 Z7 D1 i# d8 t3 w

- C% d5 j6 M2 _0 |. w9 Zvar copyspeed=marqueespeed
3 V) E. j4 L. yvar pausespeed=(pauseit==0)? copyspeed: 04 y# i3 X- }& t0 D% x( R1 ]. [
var iedom=document.all||document.getElementById
4 d. D6 e) j1 e$ L. u6 G+ lif (iedom)
7 u: Z. f7 `( {" \; p. T/ l! {6 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ q( |; g/ _; b6 i# K- {5 Bvar actualwidth=''; J' i6 {# x  O
var cross_marquee, ns_marquee
6 A9 Y  _& X, Q! k' F! O* ~0 Z% X& z$ `+ n" U
function populate(){
4 x9 z3 g. i7 ?if (iedom){3 h  ]5 f0 [, `: a1 W+ _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 ?2 Y/ `" K3 E
cross_marquee.style.left=marqueewidth+8, q- s+ v& U5 i+ S6 x! e' _3 i
cross_marquee.innerHTML=marqueecontent
2 c5 C' ]. f4 g; C" T$ cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 J# ?) H; R& C$ q6 a6 D}
& x8 R) j. q) R! p) Jelse if (document.layers){9 s0 J1 C8 ?. `2 P& u# v
ns_marquee=document.ns_marquee.document.ns_marquee2# `: p  Z$ O' o% R
ns_marquee.left=marqueewidth+8
( |/ k5 I* ]) a; y+ c$ J) rns_marquee.document.write(marqueecontent)
3 U0 t( y) V& Q, S& ans_marquee.document.close()
9 e; b& i7 \! a" M3 n, hactualwidth=ns_marquee.document.width
* w$ E8 S& p6 E# E}! n2 e: a7 e# d* |
lefttime=setInterval("scrollmarquee()",20)$ r: F: q" m1 o9 _
}
8 A* h3 y# D3 Awindow.onload=populate
2 e5 C( z) Y& p2 y" u8 U2 z  Z6 n3 W2 ]5 S( E* }$ p
function scrollmarquee(){+ m6 G" \5 ]& ]! c' M
if (iedom){
5 P. W& b$ `2 W9 S: L8 \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ N$ [# i3 `% S. N8 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 a# \9 F) J; [; b3 a* g
else
1 T+ q* J* v5 m7 F2 i. Q0 e, r8 ocross_marquee.style.left=marqueewidth+8& [8 z4 ?! Z; g( B
2 t$ F7 p# k, t' ~6 T
}
% o, ~/ S6 J8 o7 O1 Gelse if (document.layers){9 U& B) V3 j* j
if (ns_marquee.left>(actualwidth*(-1)+8))7 G: s+ H; z: I% M
ns_marquee.left-=copyspeed
4 X$ z' {- \% A; Belse" G7 U( [6 P  L5 E" ^2 u0 Q  a
ns_marquee.left=marqueewidth+8
% k$ w7 L/ a( n3 N4 K% I}$ L2 V" O. N  Q- C( Q5 s( X+ W! X
}2 [% n# A1 D  u1 T, s

0 I- ~% O3 ~! n" E* N. Qif (iedom||document.layers){( E+ l3 B! l0 B+ e
with (document){
; |1 P# ~' G: Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ D. ?" j% ^1 Z: V, B. F/ nif (iedom){8 w4 e: I) J2 x2 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 m- Q* ?* C4 s/ Y' ?8 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 P, K) y  l& U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" E: B7 L3 T, I1 J# n% Owrite('</div>')3 L0 {9 b# d7 u4 A0 [
}
1 O0 C2 n4 C* R) E! P; Zelse if (document.layers){6 @' X9 H* |* q4 c5 y* q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ \# Y% G3 s5 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 Z; H0 S4 P' f8 }- s
write('</ilayer>')
- ^  }3 d) |( {, L6 y}
! U% D3 U/ I" @6 T, e1 O. F. w. gdocument.write('</td></table>')- C9 j4 F/ W; U
}
0 l( G( j9 h- @: {. a. f}: L7 h% A& Y5 G3 b
</script>

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