返回列表 发帖

网页之跑马灯文字特效

//修改宽度8 w+ j2 D" r7 H2 K
var marqueewidth=300
' U) l& k0 w: v. t/ e//高度
2 _+ f6 x3 G3 `; ^1 ]2 Mvar marqueeheight=25, G- X' O0 a- V% Y( a) l4 r2 a& Q
//速度(1-10)# B) C' J' h* r: O/ W+ i
var marqueespeed=3: A/ L) v& E* V, Z  Z5 s, O/ ^
//背景颜色1 E- ^) i, O8 {( A) s6 }
var marqueebgcolor="#FFFFFF"
6 |% R6 m5 Z. |; {  [& y& j7 N//是否能暂停 (0=no. 1=yes)?
4 y% i4 [# ^% v/ P! t' y3 svar pauseit=1" o8 s% i! U9 F; c) y/ V( }

9 M' N5 [3 a$ U4 G9 s//修改显示内容
) y& t# |8 B+ Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 [! @& P9 I) u% R9 t

2 @; Q8 C% U; {( G1 m; U" Q- s5 X1 q! z/ B! z4 E4 H* @
////下面不需改变////////////$ \8 e# z% A3 ?( T& Q
2 [$ W) d& G' s5 ~, a
var copyspeed=marqueespeed* x" Q2 l- ?. K: m, H" {
var pausespeed=(pauseit==0)? copyspeed: 0
- O' z' k: R. Q9 j8 p/ l- j# ovar iedom=document.all||document.getElementById
# p% ]& D% J7 ?( e* k+ P! i- _if (iedom)
& E! h2 M: T* W% v# }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). B) ?1 |* g5 e' u% ?4 h5 T& V
var actualwidth=''6 Z# d2 c; y' H% e4 e" p! m
var cross_marquee, ns_marquee& w5 ~8 d- ?1 D! z( Y& k
  R' }' _0 ^5 `- `
function populate(){
* P: a" y7 C( d5 B( T- Eif (iedom){
9 q8 [7 b  b: R) M  bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* E  c) J! c& ?4 e; L/ u, K7 _cross_marquee.style.left=marqueewidth+8
+ i6 ^' E0 \6 I5 ^7 K  k7 gcross_marquee.innerHTML=marqueecontent
: l5 _4 s( m* V) x2 }! X- y& b2 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- z5 L. F  u) `
}
( x; D6 R$ w5 f8 m- h2 L) H$ Delse if (document.layers){4 j9 p3 p# k3 i
ns_marquee=document.ns_marquee.document.ns_marquee2
6 m* E$ B# b3 E  \, d: Y! S+ R+ ]' Uns_marquee.left=marqueewidth+8! m0 e5 U, C8 H+ n( y
ns_marquee.document.write(marqueecontent)
( l/ h: v: q& B* p4 N; k: s( bns_marquee.document.close()
4 u% }& z$ C2 Pactualwidth=ns_marquee.document.width
$ g7 h) j/ G% ~7 q  k, v" [}' h; x1 v2 k/ \  M& V
lefttime=setInterval("scrollmarquee()",20)
+ g: p) ]3 ^# {1 j3 }& I% [}
% J) \' @5 u5 y4 h7 a4 m% Lwindow.onload=populate: R9 H, Y, n) g( w# l- R2 \
! X% v0 W/ w0 b  O7 h
function scrollmarquee(){, @/ ?' i2 A4 }9 V' V2 t3 u
if (iedom){
( R" K' Y5 Y- w6 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% ?+ d2 h# |4 f1 K( |/ b$ g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& |5 `9 J8 ?& O
else
, r, h7 h$ U$ \: C* T- wcross_marquee.style.left=marqueewidth+87 N( o5 n+ m$ l9 I7 q" |1 _
/ S( n7 e6 `0 L/ l/ S  {
}5 j& \% K( \4 F/ G5 |
else if (document.layers){
) M' [' G/ U) P3 W6 y6 E1 |( Oif (ns_marquee.left>(actualwidth*(-1)+8)); |2 @( O' ?7 U8 N+ S& F
ns_marquee.left-=copyspeed
8 y+ T" ?0 B7 c, [, }' T5 N4 a! Aelse' j/ V  V* V) K( y
ns_marquee.left=marqueewidth+8
1 O, ]7 f9 D& r}
5 ?7 U" u/ Q$ O}
9 J) |- \6 Q$ }# r" C
5 I' H" {; [4 `9 ?: Tif (iedom||document.layers){4 y! v0 ~4 q+ y( T4 L. i1 F6 r9 n
with (document){
5 M2 w% Y$ l- E' F) {, \0 j! idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% L( Z8 ^$ c! _" z8 Q5 u
if (iedom){
" N2 P" C- ?. [3 b9 pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( G8 Z* |3 g9 `+ V- m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' n7 h  B. m1 J( o- t1 g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ P3 ^/ f- Q) O& U% t  u( @0 d) ^write('</div>')2 N' V; k! _7 v) E( c
}
, x' T" b; ^3 M# @8 K$ A- helse if (document.layers){
# D+ d" C! f/ f: p0 p2 A# I6 b" Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 ?7 ~4 Q" t* {) m; s0 k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) E* \5 K9 g  z6 M! A
write('</ilayer>')7 P* d; U( Y* \# {- \9 T
}7 N- V" ?6 X/ c0 Y! u
document.write('</td></table>')1 K! ]3 _8 V3 ?, f8 b# y( G6 [
}
; Z* ~2 ^7 k3 \$ C( k1 Q0 ~}. ]4 O, M; n/ I6 g3 N9 B" w$ ~- x
</script>

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