返回列表 发帖

网页之跑马灯文字特效

//修改宽度2 V# @# j- L  o: B7 O5 `
var marqueewidth=300
% j. A4 d( Q+ [# y- D3 Z1 r3 n8 B8 k//高度
# e. M% [- W- b# Uvar marqueeheight=25) j6 B; H4 x& S* h1 F
//速度(1-10)3 o% q) e7 @  \8 {6 F  D
var marqueespeed=3
8 P  |* K0 a: U* p4 D//背景颜色
7 y+ N1 K* {  n& `0 xvar marqueebgcolor="#FFFFFF"
0 J+ ]: F" m2 S' I//是否能暂停 (0=no. 1=yes)?8 w- n( R% W  j" f7 t, z, C( J
var pauseit=1$ ~4 b8 Y5 V' t4 M" k0 c& i
/ i# _  w7 g" {$ H7 y# j6 |
//修改显示内容
+ K  Y& T- B; R- Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 K- v/ C$ W- x/ E$ n

. Q$ o1 m0 P4 z# {( S1 O. I5 N7 ^( ]8 H
////下面不需改变////////////
1 i* q/ K; ^8 N  Y7 C2 w2 x
6 W: {9 M4 k3 z9 [3 e- E+ G2 Lvar copyspeed=marqueespeed
. a1 E3 I7 G* bvar pausespeed=(pauseit==0)? copyspeed: 0
% N6 u) b$ o/ j8 E; cvar iedom=document.all||document.getElementById
+ n( n, C8 p- J/ Zif (iedom)6 U8 C/ Q3 N) Z5 [; w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ S2 T7 y' R( h1 T
var actualwidth='', {. x6 |8 E. v, O
var cross_marquee, ns_marquee
! q% |4 y. F2 A4 X3 c, p
7 e( i; E% w4 X6 S+ [* B2 [function populate(){0 i) m. ^! ^4 e
if (iedom){6 @2 I* {/ I- y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. V* d: x7 i( v& R4 across_marquee.style.left=marqueewidth+85 f# \- Q- |$ Y( f8 p1 V
cross_marquee.innerHTML=marqueecontent  F2 B- K2 z; w3 j8 l# \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" ~, a1 R& j0 g9 G5 ?}  P- P( D8 P9 Q: K; R3 c3 o7 k8 S
else if (document.layers){. B  z3 O# P2 y6 _4 I
ns_marquee=document.ns_marquee.document.ns_marquee2
7 w# K. M, u- B  r  rns_marquee.left=marqueewidth+8
) B$ }- B: x% H3 P; W" j4 _2 a3 kns_marquee.document.write(marqueecontent)% ]$ [4 Q. I2 L
ns_marquee.document.close()
5 Y# V  q$ P6 _+ t8 h' U5 Q: \6 y3 n4 _actualwidth=ns_marquee.document.width
5 T$ A& Z, p1 u( R% l}& b3 Y6 H7 N$ M! Q$ E& U8 k
lefttime=setInterval("scrollmarquee()",20): x( v' ^% t. J4 E  o5 @
}
7 T* I, k4 V+ Y* N" m5 M0 nwindow.onload=populate* j/ U$ q, ?* X8 z( J& u
2 M6 j0 Q' w7 c. q3 j3 K1 S6 e
function scrollmarquee(){
8 v* I' d8 B' N' _: J- s, Vif (iedom){
5 u: f" c; m6 W% T% mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& W6 w" p0 p7 q( g: Y* Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 O' k+ \  N: [; |) f2 S# @; Uelse+ j. H, }( R3 P* ?; u2 ^
cross_marquee.style.left=marqueewidth+8
" Y+ @+ V" P, l; ?5 t5 q7 D# [: H  w) f; S4 w( W% V1 x6 n+ q) l* B
}
$ y: \1 K- J1 {' [4 Selse if (document.layers){' d- Y/ r0 m8 u
if (ns_marquee.left>(actualwidth*(-1)+8))
  b. P( k4 o# X" \5 k$ I! Bns_marquee.left-=copyspeed
: I& e9 ?6 n7 W' |else
, `# y% \3 g( ~0 u9 h& `5 k5 Mns_marquee.left=marqueewidth+8$ L# t) R! g- S# p8 l
}
' H: l( u3 a) W+ K2 @2 ^/ q' F}" k" w' q% n+ G8 f7 k) U
! N! z5 s7 }' b9 u" [
if (iedom||document.layers){
, p  u: [% W( @with (document){1 q  `  ~- u4 S/ G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& T" O! M2 e% X7 ]5 m2 d
if (iedom){
6 C6 ^/ ]! E4 g& iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" A! B0 z! G4 n8 `+ L2 c$ D6 f& c/ Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( h& M: ^1 \8 v+ q1 @! Z4 _+ u, D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! b- m: G; q% h& i& q/ U! ~' zwrite('</div>')* I. w0 }) G9 b
}* J8 T. U% R) r6 z; F: r
else if (document.layers){
0 }# c4 w+ s! N5 L! z, f1 a( Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ x5 L% t4 w9 `/ b6 R& q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' K+ V/ C5 c/ n3 Z8 S3 Jwrite('</ilayer>')1 S- h6 L, r( k  e9 Y8 b
}
+ I- t# W: U# K& i! `0 Hdocument.write('</td></table>')
) |2 r6 A0 f% `9 d}
/ q2 k& w8 K6 }( H3 n9 ^$ c}
7 M5 u- i& K# q/ g. F+ z9 [8 N( u</script>

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