返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 \# Y4 j0 I- r! h' c- q8 U- T* Jvar marqueewidth=300
; c! j1 N8 g/ n7 R6 r2 }# w' d; O, C//高度" n* U, V0 F+ C6 x+ L( c
var marqueeheight=25, W+ `) U9 W3 }
//速度(1-10)
6 e9 w8 ~. E6 Jvar marqueespeed=3# x6 j: S+ j- R# e* J
//背景颜色& k: b  H8 a, ]( _7 f0 ^0 v* F
var marqueebgcolor="#FFFFFF"6 u8 v! A9 o* U. i) B
//是否能暂停 (0=no. 1=yes)?
' |; k6 q+ P1 C4 O- r" Nvar pauseit=13 C2 [. `: ~8 b* `% I0 d6 m! N# s& T
9 j2 G9 C( a: _" [  r) {% \. j
//修改显示内容
8 ?7 D# A# ~# N4 e  Y2 v' T8 E3 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. t; H- l, L6 S: ~) \

2 W3 |, R2 Z3 E2 F4 w8 ^9 l3 z. ]& ~
////下面不需改变////////////  n# W) P" s% t' b4 ~/ b5 V  U

$ U0 w' q% z* m5 x2 m# j7 x; I7 Zvar copyspeed=marqueespeed
5 v* z% l( y3 W& V1 `6 T5 @+ l: B" Ivar pausespeed=(pauseit==0)? copyspeed: 0
7 f$ O4 `& I! E: Z* F  nvar iedom=document.all||document.getElementById+ r# @1 v. w  n2 Y) q8 B+ w
if (iedom)# O/ a4 L1 Q6 A8 X( k% F% J/ Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 Q8 x# Y* e. Q7 E4 ~0 |var actualwidth=''- ^' N2 f; A& S8 v3 T' \! w/ l
var cross_marquee, ns_marquee: I9 I* u. I" N0 s& N+ G! o
: X- A8 n) q/ C3 x6 r0 x
function populate(){- T6 _6 k& b! S% x$ q6 U
if (iedom){
" l- a& n  h# [$ Y5 O1 f2 `: w8 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 y( k& Z( R( l/ F6 S; t" n) F( `, Bcross_marquee.style.left=marqueewidth+8
% X8 ?! x( ?3 S  @8 w3 dcross_marquee.innerHTML=marqueecontent' [1 d, ~( c- p! F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  `/ e: ^2 i* }4 X! v! v6 g1 y/ C}4 _7 S4 w9 \/ M) z0 E
else if (document.layers){
: q/ z, X) b9 {0 ]! N1 K7 J2 bns_marquee=document.ns_marquee.document.ns_marquee2" P: ^; J3 F7 w' }. Z$ w
ns_marquee.left=marqueewidth+8
' h9 t6 \- o6 K7 T3 Fns_marquee.document.write(marqueecontent)
$ F9 b, B8 X: c% ?# Ans_marquee.document.close()6 k+ {- D- c# m5 e& C! u7 V
actualwidth=ns_marquee.document.width
. R/ @% s; J) `0 K- z; h}
# f! p) B1 O; Q, v% Q2 }3 flefttime=setInterval("scrollmarquee()",20)- O: a* r; U+ q; K
}* U: k& _5 x* U5 M4 I
window.onload=populate1 [& p7 K: ^6 L1 F# P
" n, d" T1 A: Y7 X/ h
function scrollmarquee(){
. w1 E7 Y* Y( N# E* r( X% tif (iedom){
3 T$ Y* v% W" O- j+ J! N' F2 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 E( @5 `- Q) Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( j: \( O+ d; e+ `7 c
else
) g2 _! ~: V" B$ P1 _  I. ~6 l6 `cross_marquee.style.left=marqueewidth+8
( T* B# q& r9 `' q
/ I: ^7 k$ `% `# \( z  u8 U}% L# n! C+ M9 V* y; q
else if (document.layers){! p' j3 e. F" ]$ ~0 o% @& Q# y
if (ns_marquee.left>(actualwidth*(-1)+8))
* D7 e+ B1 f' a3 ]8 ~, Lns_marquee.left-=copyspeed
# i+ Z; y! E! `: `/ }5 j3 G: G- aelse; O% A( |7 B3 e; @- v( T( {
ns_marquee.left=marqueewidth+8- E$ K! H+ M: T/ _! e" c
}
' k. v- |# x9 t0 d: q7 I* _5 q}
/ c2 n9 q; A, P' X7 X9 ~& x" p
% S1 K. s. {' |7 m* n, Aif (iedom||document.layers){8 r2 L0 T' R$ F# y5 P/ i7 e
with (document){
- o2 M: M- X& D: s. T' x0 vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% W+ R/ s7 t8 X' J+ n" m: k
if (iedom){
; A* ~2 |- {" S' a7 l! ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 {2 F/ O1 ]. [2 B4 Y5 P4 {" ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 U- x  f2 d0 \: x# c4 J% P* X) fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, ]! l, f0 Q& @8 C$ gwrite('</div>')* V; ^4 n& H6 H3 J
}
4 R+ U  ]) T; x5 Kelse if (document.layers){' v: F, i7 J0 M8 y0 |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 r$ C) U' |5 k/ e+ }- v$ uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 Y4 P  r" z5 ^8 owrite('</ilayer>')
, Q8 S/ n, z9 U: _+ A9 i, K) r}1 l( F' j3 g$ R1 }% ]
document.write('</td></table>')2 c7 X& W( u1 |
}
3 E7 `7 ?+ V" k" M* l8 ~+ J& F}/ K6 Q8 o" f% c, C1 l2 Q/ f
</script>

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