返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 {0 A3 O* s, f. O' |
var marqueewidth=300
/ ]9 d; m) ^# m# _$ {9 }//高度' Z( c  p& g$ c' q9 O! T" K3 j! e
var marqueeheight=25; r% c2 K1 l( m$ d% e, i4 j
//速度(1-10)  J/ Q/ j" C5 Y- p
var marqueespeed=3
0 X& |5 I. ]0 I* m//背景颜色- E& ^8 ^7 S( K( Q3 W
var marqueebgcolor="#FFFFFF", T9 P5 s" |+ c* \2 W9 Y2 c
//是否能暂停 (0=no. 1=yes)?3 G) D0 z2 s! a) n
var pauseit=1
5 p  G. N% U1 l$ W# D0 o) s  k- {
- q9 v9 _$ R) y# [//修改显示内容
9 I" ^  m0 Z" |( W5 T2 Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 N7 r/ ~8 l7 s  N: N2 Z+ t  Z# {# s2 v/ K; |" M

3 b5 a) `1 U0 d7 W# s1 p! y////下面不需改变////////////
( R" H/ }7 Z+ R0 p& }9 E6 O
9 B2 q, {" }- K4 Evar copyspeed=marqueespeed( }' s% b: G+ |4 A
var pausespeed=(pauseit==0)? copyspeed: 0
; X" L# i# @( j2 v7 vvar iedom=document.all||document.getElementById4 t$ x% ?, u% u6 Z- w$ i. r
if (iedom)
  i7 @6 T. p/ \; [: e5 t* Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# P! v8 V& ^0 Y" X0 ~var actualwidth=''
% D' F; D. t( F' @) T: |) rvar cross_marquee, ns_marquee3 g. _0 L  N& X9 g3 c

0 J# o6 u; c* Z  Y/ S- h: J' G, Afunction populate(){7 }; V# q# R' K) m- X
if (iedom){
/ j: j& l$ X/ ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# g0 ?3 _  [5 i
cross_marquee.style.left=marqueewidth+8) e; L2 F9 s. Q% B; f+ z' N8 P
cross_marquee.innerHTML=marqueecontent
3 o1 k5 ], p1 W8 |6 d5 x- ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! V" s& {$ k! r
}
. u) y  s2 \- q  p0 G+ d- @5 Celse if (document.layers){" `" b" L; Q& ?0 Z8 d" a$ |
ns_marquee=document.ns_marquee.document.ns_marquee2
9 s# Y& M( V0 U" S# T0 f! nns_marquee.left=marqueewidth+8( M, }4 c9 I1 b3 y
ns_marquee.document.write(marqueecontent)
$ L9 d8 `; M# w3 F* U; x! B* ons_marquee.document.close()
9 P. [' [# C" M: aactualwidth=ns_marquee.document.width4 Y9 ]9 L* f) A' K& E  y/ B3 w! S
}
  N+ ?8 j( F5 d6 F( H5 T! ]lefttime=setInterval("scrollmarquee()",20)
* g0 b6 Y- S1 {}5 u) W; {/ t' ?) x( |0 T" b
window.onload=populate- o! y" ^8 s" @, s4 n0 U
! j, ]9 B% Y) C( \$ Z0 f( w
function scrollmarquee(){+ H6 C" ^/ X+ z( T
if (iedom){
* @4 y9 ?2 v; Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 x; j! z6 A1 c6 N3 L7 {# G0 i" v5 k$ }4 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: _0 V& Q7 o( Ielse8 U2 m! O  F" }8 \
cross_marquee.style.left=marqueewidth+8
! Y* M2 m' z3 n. W9 K1 t' d; I8 e: x/ ]: V4 y# W4 L7 J/ p0 z
}$ T" m4 v' q6 d
else if (document.layers){
4 s3 B, \3 j2 N* Zif (ns_marquee.left>(actualwidth*(-1)+8))9 c% o0 \0 }* y8 F
ns_marquee.left-=copyspeed9 e/ ^. F: s4 e' n! n7 X9 d& S7 G* ?
else7 _2 E/ u; h: ~3 o7 c, A( N* x& V0 X
ns_marquee.left=marqueewidth+89 n7 i  M7 N. R3 j: p! F
}
! m  `+ ?% m( B5 A6 J" I; }}8 J: L& V, {' G

# t: x" w; ~# Mif (iedom||document.layers){7 ]5 D2 t$ J2 i% q& E
with (document){& E  Y5 }& n: m. H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 h4 ~6 S; s! X8 A* Tif (iedom){7 i9 [, n9 Y) u+ Q/ t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: U: w9 w/ H, C2 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  Z, K0 Z* w! _) P( j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 J$ J$ X) F# {4 b; ~
write('</div>')
4 Y5 ~- V! r. f& A0 G( b}) Y6 h. S3 [3 A% u4 x" r1 |  s
else if (document.layers){
5 i. S/ Q& p' d- i5 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' N: ]6 L5 g7 y9 W0 e- G* l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* A! {8 o. v, gwrite('</ilayer>')/ e, Y0 l3 P" K" B8 \
}; S: y4 r9 f* V# p
document.write('</td></table>')
) s: L+ M2 e# I- f7 v3 R}
( x7 L/ n6 B! E7 g5 R}$ ^; u- e' {; b: ~- ?0 {6 g
</script>

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