|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度" z4 K1 n8 v5 @- J% K. i& [7 o
var marqueewidth=300
. `8 s3 D# G: O# g//高度* U* D# U! S. B( r9 r6 u
var marqueeheight=25
# z8 o' p. h/ k* j8 D4 B//速度(1-10)
3 z7 F3 D) f4 X2 w8 c; u5 yvar marqueespeed=3
# n/ h9 P+ H2 m( m5 ~, F- c//背景颜色
1 @+ n1 m, o# q8 A' tvar marqueebgcolor="#FFFFFF"
- i7 z/ ^+ C) G0 u& y6 W//是否能暂停 (0=no. 1=yes)?
& N, O; `+ \ U# Y" [: Pvar pauseit=1
# ^" u4 _) f: z
; ~, n' Z; h1 }1 N//修改显示内容
# M/ O2 q0 `& z' v$ E& |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ C9 u* H& T/ _' g
* w' y/ l+ h+ |3 M
# T; C( ?4 H& E$ `4 s////下面不需改变////////////
( v. |" N! G4 V) ]5 Q# K
% m4 D a6 ?2 Hvar copyspeed=marqueespeed1 T" x5 A. F& V( t; ~8 I
var pausespeed=(pauseit==0)? copyspeed: 0/ L* s: a' O. F0 N* p
var iedom=document.all||document.getElementById
0 T8 C j' I. u* d: Dif (iedom); ~$ r9 g& r( T4 B6 t; w2 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 B- G3 e9 r8 ]& m# k
var actualwidth=''1 i+ W, o: ?3 V' N- c1 _; I$ Q' X! X
var cross_marquee, ns_marquee
8 R( @! D2 G) {
$ y4 G. d9 c5 Jfunction populate(){2 V `2 z) o3 ^7 m! V0 ^
if (iedom){8 P3 X& E5 t0 d" N& D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) \ [2 g; r! w/ Q1 ocross_marquee.style.left=marqueewidth+84 j8 q# \; {# ^2 X
cross_marquee.innerHTML=marqueecontent
+ O3 B$ \$ o8 q2 s3 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% s" k, n% O( H: b) w}
; U' w7 U6 {" Y- I; F1 ielse if (document.layers){
5 D" ]" [, n' N. ons_marquee=document.ns_marquee.document.ns_marquee2% x' k$ t' `( g# `
ns_marquee.left=marqueewidth+8
0 D i8 {# X2 t( h5 w' q. V1 Kns_marquee.document.write(marqueecontent)
5 S& t( z$ n) m' Y' d1 Vns_marquee.document.close()8 K- Z9 a( Y: J4 z8 ^; B( R
actualwidth=ns_marquee.document.width' y' e+ R4 [5 o$ t* `, u2 P& i
}
: ?5 c2 f/ M$ o; ?" V! a$ I2 `lefttime=setInterval("scrollmarquee()",20)
$ o& N% R, M4 O2 J: o; x}
$ E2 ~' L4 F! I0 S9 Rwindow.onload=populate9 f% `( p* y" B9 J: C: T& X7 g7 r: w
, t5 k( T. |3 Y& b F8 jfunction scrollmarquee(){
* L7 r) x3 g0 nif (iedom){' _9 w8 {7 X" y9 M2 q8 j0 _" _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% d3 _$ B9 S0 A/ ^8 G/ D6 E, n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, Q( u" ~+ _* q' Z( Aelse8 v- m, e. \' b3 c( F: Z( A
cross_marquee.style.left=marqueewidth+8( t. t/ R; y0 X) N, p" W
1 Y7 F* Y7 Z% o, O8 y6 t, ~
}9 g# _7 e7 u' c% w. v+ Z
else if (document.layers){* d$ }/ a- ^" E5 x# l
if (ns_marquee.left>(actualwidth*(-1)+8))
% l- ]8 D$ {9 ]' s% c" ^0 Wns_marquee.left-=copyspeed( z! M2 R3 b R
else
/ y \& f$ @' ~9 `& Tns_marquee.left=marqueewidth+8/ r. O/ t+ U# S9 c
}7 L+ y y# c; K' ~
}
- q+ A1 P7 R) [3 k' `+ F* J( W6 g0 g+ `( I% g
if (iedom||document.layers){1 r X# Y; C9 C. f5 V2 Y. `/ |# H% r
with (document){3 L" U' d0 f4 V+ v8 w* m% T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, b( O: d& U: o- d9 s; Nif (iedom){: `4 B1 h. b {! X% Z0 y$ I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# |( h8 @( n! _. v+ t1 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
d# H8 P* y8 Q' D+ o& dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 F. Z# [- V- o3 Q3 `0 k
write('</div>')
8 s/ K O. Q$ N! c5 y, l- J! W, ]" p}
( g8 S2 m1 m( I. ]+ I2 }else if (document.layers){) p* U& j4 M8 F, d6 N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 E1 l4 b3 V$ B1 |, H0 l3 S( N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" n8 _: E6 s7 m$ L% Hwrite('</ilayer>')2 F; K. q1 E( u; p
}) E4 I' B2 _! r; _+ K
document.write('</td></table>')
9 T6 P! ^/ [8 J8 A% R: G8 J& ^0 ^}
, E8 |3 u/ \3 g$ g6 v}
" T- k: C, v \0 w- G</script> |
|