返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 V! i. B3 I# Z5 C) Fvar marqueewidth=300
% G# x6 y! d+ h' E; Q2 c& c//高度/ z& @# v: X2 p. m+ ~5 o
var marqueeheight=25
5 c' L5 ]% I- S- C+ Z//速度(1-10)
/ P; ~- h4 N! Pvar marqueespeed=3
8 K  _/ h% [/ D, u  V//背景颜色
+ v$ k3 D8 G! s; Tvar marqueebgcolor="#FFFFFF"4 y! ]0 |; Z% x6 p
//是否能暂停 (0=no. 1=yes)?
2 ]3 }! U+ N0 K# Lvar pauseit=1  F" B/ ~3 h( h9 L  B% o/ E! v
' S( C! @  v- W6 m0 f4 K
//修改显示内容: Z: Y) o% f3 w8 Q! T. ?
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* H6 l9 |9 Q# B' g2 I7 Z: }7 z% d, X, g1 l: x

) b  M( z4 G) r! G% r////下面不需改变////////////
$ p" ]' V$ w) \% @% `" z" g2 R9 V. T0 V: U2 s
var copyspeed=marqueespeed
6 T4 d  z  i5 ~6 @7 u1 \5 c2 O) F) R0 Ivar pausespeed=(pauseit==0)? copyspeed: 07 P+ n! J1 i1 z5 m" j/ l2 k5 j
var iedom=document.all||document.getElementById
/ X" X/ Z' @  Z% C, Z! fif (iedom)
5 n8 V3 z$ h0 Q4 p" W. l2 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ f% E' T, [# V- [var actualwidth=''
. X% ]8 k% S6 x# Bvar cross_marquee, ns_marquee8 v- \% `- H) ^
( f) |/ M  D2 _2 |: t
function populate(){
' ^' `3 X) z" q! {, kif (iedom){- q$ }+ z! I+ @% q- t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  \/ O' |$ ~3 [cross_marquee.style.left=marqueewidth+82 J: l& V) `8 f% ~
cross_marquee.innerHTML=marqueecontent
* Z) o' ~- t6 S  C7 D+ `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* _, p  I0 e; `3 N4 J, d5 |$ Z}" V% @5 c# ~% h* f
else if (document.layers){' b& o; k! P* r) `9 j1 E5 A
ns_marquee=document.ns_marquee.document.ns_marquee2
) v4 a' M0 Y& R8 y- A& F# |$ Ins_marquee.left=marqueewidth+8
4 _2 g8 J7 Q+ Wns_marquee.document.write(marqueecontent)1 Y, ]8 F. n) r/ J
ns_marquee.document.close()
, q3 ?, J( y: J9 O) b, Xactualwidth=ns_marquee.document.width% m) c# k1 ?8 ]" A* U9 U
}. P: o$ m& u' \  u
lefttime=setInterval("scrollmarquee()",20)
0 ~8 R& E" z6 F! s& w}
* G( U' @) {" X1 U. z, [4 ^0 S: A+ Cwindow.onload=populate
9 F: c& i& T7 R$ E# q$ t$ Z
; m7 [, z& j, U' W  tfunction scrollmarquee(){$ s$ d# Q( ^: p& c
if (iedom){
" j/ r2 \  q# c& Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 r9 F. L1 Y  ]& qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ @+ e* ]$ ~- F/ Kelse% F3 p$ m; O* Z+ G; z
cross_marquee.style.left=marqueewidth+8# f1 D1 o0 d0 ?$ i8 \% F5 \) G
8 |' K! t% D) O& D- Q  s* H6 Z8 C" J; Q
}% M5 n6 T' y$ m% W
else if (document.layers){' k; _/ c2 }8 d
if (ns_marquee.left>(actualwidth*(-1)+8))
' \3 c* s! r% x3 ]" w4 r8 p1 _ns_marquee.left-=copyspeed
* u8 B, v4 G- Jelse
: G! o# Y7 g) D7 C2 ons_marquee.left=marqueewidth+8
1 V9 C7 G- Q# e7 e}
/ @2 B% V1 O2 Y}
2 L; r9 q* Z* b; @
9 X' Z4 ^- O& {" I8 rif (iedom||document.layers){3 V( z% L! H$ G
with (document){
. K3 B6 j  P2 ?, w1 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 Z+ J2 g/ E6 _. E/ ]if (iedom){
- N9 u2 |6 U: P5 J+ n5 Z0 Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( r; U2 x3 h2 \& v5 w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; s+ a6 \1 p8 s3 ^/ b+ j/ `! D) Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 a# u% S, y9 t) H5 h9 Iwrite('</div>')5 L, Z! X  D) b6 d$ q
}- }1 ?; b( h* ]1 E% ]8 }# y
else if (document.layers){
# {$ Z; ~' i6 x" i9 L1 D8 }8 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- V* c& A/ y$ Y% ?" }9 L* z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 H5 T  k* R& `, l( \write('</ilayer>')
4 h) {( b3 }0 M8 D/ p8 s  ~; g" N3 W}1 j* i% o4 y; X$ F# b; N6 U+ @
document.write('</td></table>')' ^, Q7 n7 B6 [; M
}
) K5 h3 Z& m' W1 P7 [6 X9 h}; }' m$ z8 v" K1 M
</script>

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