返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 @* D4 z0 k+ i; y9 mvar marqueewidth=3001 S1 D; q3 A2 q& _& _
//高度" J2 b/ i* C) S& H( b+ [/ @
var marqueeheight=25
+ W: O& l: O' c8 [, ^3 p! Q//速度(1-10)$ s' I! ]8 C+ k; y; k
var marqueespeed=33 T7 }- W2 S. E+ m) {  h/ N8 o
//背景颜色
6 h% Z2 ?! j. \3 `, r+ Cvar marqueebgcolor="#FFFFFF"
9 K; ^+ @! Z1 K9 d/ G( ?//是否能暂停 (0=no. 1=yes)?
& u$ x/ p+ R4 Bvar pauseit=1
& D/ T" t: {4 v& I  c! x$ q* r! F
; Q) X# ]- G4 J2 K9 Q1 u" v//修改显示内容
6 }% N# _/ L0 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 o6 O: c' n" d: `
/ `2 v# T: M# G: T+ k

/ l; u! q! C) k) \; `////下面不需改变////////////
6 T1 e% Z5 Z+ t! H- Z
  u- }/ g2 F/ ?6 ivar copyspeed=marqueespeed- S  d2 R- y! p6 Q$ H* X7 h& |
var pausespeed=(pauseit==0)? copyspeed: 0
% c$ Q) g( ], k0 a+ ]4 Svar iedom=document.all||document.getElementById
5 N, l% s& r+ j8 b) ?) V7 dif (iedom)! [; O7 q8 i+ I2 k6 I  b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! ]) ?* Z) g3 P0 Y& X7 q0 l6 L7 v) evar actualwidth=''
. b4 l0 A; c* ]% l2 Ovar cross_marquee, ns_marquee2 B" n, R7 \# A$ f0 M& {

3 h) W& g% F) d$ r3 l) ifunction populate(){
. ~' _, w% k. Gif (iedom){
, M1 Y5 u# o. A/ fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' P* ?: R, v' |* K: c. f5 z) O2 e; i
cross_marquee.style.left=marqueewidth+8
' M# l1 A: }/ J5 icross_marquee.innerHTML=marqueecontent
1 E! d, S) t" q# s# @2 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' [! r0 Y/ ?: Q( d: ^) P
}& U0 r* h( m" t* {8 F: {
else if (document.layers){! ~: R  ^! Q2 M; s" K% H
ns_marquee=document.ns_marquee.document.ns_marquee2+ _/ t7 T7 L# ?0 |$ N' q: V
ns_marquee.left=marqueewidth+8( l' Y& g# R0 A1 k. f
ns_marquee.document.write(marqueecontent)
" E& V1 q9 B, l1 F+ fns_marquee.document.close()+ I& g/ f7 e# f+ J1 M; T/ ~' R4 N
actualwidth=ns_marquee.document.width( D. W8 T7 Y) K; [% k
}
" z( ]7 a7 h6 X$ _. Plefttime=setInterval("scrollmarquee()",20)# H! ?0 D# y- ~- j* }
}
" }. T( H- B9 T: awindow.onload=populate
5 ~8 D) {! y; R
" {1 ]2 S+ y3 d0 ~function scrollmarquee(){
+ s1 c2 {# R# j5 R5 p% W. `if (iedom){
5 A) y: g2 I5 a6 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) V% ]( l) O! I/ A, U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 x; X4 N2 O1 e% D
else- z0 E7 r# g  E+ g
cross_marquee.style.left=marqueewidth+8
( l/ w5 w& Q- _9 `& {
' e+ g  U+ |1 y}, S$ O( S/ o7 v% q/ u) n
else if (document.layers){
; t! b$ V1 h7 i8 `* ]% Uif (ns_marquee.left>(actualwidth*(-1)+8))  o1 e- v% t0 l5 n- ^6 p0 b9 e
ns_marquee.left-=copyspeed
6 c8 m' y; V3 selse7 O0 ^% j) u/ c$ K- N' T
ns_marquee.left=marqueewidth+82 X( @/ L- _! R: ?( l/ |& \
}# G6 D0 }9 x: v. B
}
, l* q3 s0 p/ R8 x( |' v+ P
; Q' u1 b; d5 K+ ?7 V% A0 [" ?if (iedom||document.layers){% ?% }$ K$ |5 h$ X8 |& d
with (document){6 q) r* \& Y' C: }# f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 `7 u5 ?  w- K5 eif (iedom){
/ K, [; i0 U# e/ a$ I5 C& Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ F& H5 c" ?% L- @& hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; Y' x3 c: Q6 s. gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 H) P6 R0 o2 r' a( g& J
write('</div>')
) _1 O5 g( ]+ o  K' t0 T6 Z% M, I" K}& d- N5 M# x# A9 K' y* {; b9 E! M3 V
else if (document.layers){
! u" R% S' j. d' `; Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 O& p' K& J2 z3 l; B5 p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! J& m5 J) a" N* S4 m8 Awrite('</ilayer>')& I8 U" ?2 O5 l  H8 u
}5 S# L# b- ^" t" ]! `! j6 z
document.write('</td></table>')/ ~; C6 w6 c# T1 b+ B, a" [, _0 W
}
; o* Q& p# _0 V1 ?" h' G}
6 `  x( t- z' Q5 [1 Z</script>

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