返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  R3 t% \0 T* d; x6 r# M$ Yvar marqueewidth=300
, J  Q0 G% t1 }0 G  }* O3 c//高度' n9 W9 o$ @# z; U+ n
var marqueeheight=25
5 a! B! j. @; o- A0 M, _; ^//速度(1-10)7 C5 t  U) T: n% S
var marqueespeed=3  ]! S) @% X& @
//背景颜色% r# y# Q$ I# z5 n
var marqueebgcolor="#FFFFFF"
0 b2 V' |0 S2 Y' l5 b//是否能暂停 (0=no. 1=yes)?* B% i! K1 X! v; b
var pauseit=1* u3 j, w) E0 _  a
6 ]+ C" j1 F4 K: {0 c
//修改显示内容
7 E- {2 ?/ u6 W6 hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( }* ~$ f5 j4 }0 f- p
4 C% j# n+ j: J5 U' q- U( `8 B6 q, V
////下面不需改变////////////+ e/ |( R+ G9 q. b, p

( a8 ~4 B1 n6 N+ A  W* Dvar copyspeed=marqueespeed
8 m1 i  U# q* ]. E! q0 A7 b7 gvar pausespeed=(pauseit==0)? copyspeed: 0
+ h9 ?# S! B  H$ {var iedom=document.all||document.getElementById
: v5 h0 b6 A! B$ v! tif (iedom)
) [1 L/ |# D% U" W6 l/ B9 Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# x  w/ g1 M: C2 x/ m% D% U1 Z
var actualwidth=''1 P  [! ^2 ^6 e+ p6 D
var cross_marquee, ns_marquee
0 i/ }" G. o1 X. x. @! l1 D/ h, L$ X3 K  K. S1 f& m
function populate(){
6 ]* ]  Z# N% Q- k) o3 o" D( }if (iedom){
# q; x9 e& E4 _. g9 Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. H( ?3 n7 [+ I: x0 z, D
cross_marquee.style.left=marqueewidth+8
! b' G% H5 |7 }. b+ |' kcross_marquee.innerHTML=marqueecontent
* l( l9 d9 w4 t! P8 h, eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ f( q+ r  o$ m5 N6 V8 c- O9 p}! Q5 K/ d+ i2 F4 w1 G
else if (document.layers){
  k7 i! U& d3 i* @+ u) q: cns_marquee=document.ns_marquee.document.ns_marquee2
  V: I$ s4 ?" J6 k- yns_marquee.left=marqueewidth+8  `3 {# K" [9 B. `2 v
ns_marquee.document.write(marqueecontent)
' @! F: l( L9 i% K, ~ns_marquee.document.close()( K5 U9 E6 ?2 P& V+ ?) o% ?* n
actualwidth=ns_marquee.document.width! T- I2 Y' m0 ^
}0 G  h, M8 {4 G- P
lefttime=setInterval("scrollmarquee()",20)  E; ?7 o, _4 \
}6 N: s! w# S* ~: W) ]0 o7 J+ A/ C
window.onload=populate
- x! |$ @1 S( Y: w. @3 p6 m
. [) `- d) c: L) p' G* sfunction scrollmarquee(){
/ @7 g) P, V7 m2 q' ~if (iedom){
7 a; c3 U) J; R& G/ ]! Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ M9 Q- F/ t, J# K7 A1 M5 b+ vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: {0 s8 I' I/ |! D3 L
else+ N* \8 `1 Z' r
cross_marquee.style.left=marqueewidth+8
8 p+ `. U: b4 J- c3 s8 P
( l$ y( R3 A: e+ P% U* ^}  R0 n, W/ @( C
else if (document.layers){
' g, _$ V) n4 L5 P3 F: h  s7 k" Pif (ns_marquee.left>(actualwidth*(-1)+8))
. d7 c+ O' i: Ans_marquee.left-=copyspeed
0 {$ X9 [* k2 ^  N& ^$ D, O2 zelse: G- j+ m8 i, Z; n
ns_marquee.left=marqueewidth+8
3 E: s* s9 i4 q% `% ?1 w}
5 W$ u( b8 I/ h( ?6 r}
8 a# v3 J  L( `7 Q; k/ W" |2 O( {. {6 j5 Z# h. W3 [3 p- Q
if (iedom||document.layers){
5 }9 _# B# D7 C# Q7 g5 Owith (document){
! M0 G8 C) d2 h1 C4 h$ u* b3 w3 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 r, Z4 _+ E& v5 f  Y
if (iedom){( x* y3 n! u/ T6 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 V. L) H+ @% o# ]( ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 l. c% @. m# u" |' v% }: l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% ]. G& d# a- {1 ?2 X5 Mwrite('</div>')
% |) b' c& K# C. N}
2 V/ p  {2 L+ P, G# ?1 z7 {else if (document.layers){! v: E! o' ~( @6 I) G+ t3 f) r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 }: f3 @# u8 p6 U3 twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& g( |. d8 b0 L" J# u1 i! H$ u/ l
write('</ilayer>')7 J" j, |7 {9 @3 f3 j
}; [; L' T$ Q/ c8 I/ R2 |
document.write('</td></table>'), f) V7 V; |" w0 N, F! H
}
" @4 ?# d9 G) n' D1 D}% {% }! S: l$ E% F( z& O, _' N& V* [
</script>

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