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

|
网页之跑马灯文字特效
//修改宽度; s b' F# G2 p9 n% m( R+ ~0 Z* @: K
var marqueewidth=300
8 o7 e2 {/ V" l/ z: ?$ h; L6 `$ c//高度
% e0 {- D( X } {( Xvar marqueeheight=25
2 F: R3 F. T- Y# d6 T//速度(1-10)
" N/ s& _# G( l# h1 Nvar marqueespeed=3: @9 G, K; K. x0 e
//背景颜色. K2 R6 O. S# E! r# B) P8 s1 v
var marqueebgcolor="#FFFFFF"# f9 X2 k# [4 ?. {
//是否能暂停 (0=no. 1=yes)?8 C; D" j7 }3 c6 S5 a
var pauseit=1
5 v+ H: ^" l: ~4 R
4 w2 L" w! q, f/ a; g//修改显示内容6 _6 W1 F' g# L3 x8 g, e$ a' _4 U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% v9 d7 e/ z; j7 z+ y# l4 T4 ?% z d; ~( z4 C" }# z
, H8 `6 s+ U/ ]$ a. f i////下面不需改变////////////
- G. f# X; x& m9 |- G4 k. C2 K! ~- x( X' i9 W
var copyspeed=marqueespeed
) w N8 Z8 B, p1 bvar pausespeed=(pauseit==0)? copyspeed: 06 p2 J- e/ D& C+ y
var iedom=document.all||document.getElementById- I6 ^( @2 y. X4 y9 [. q
if (iedom), T1 z$ R1 `9 a( S1 |4 n7 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- H) N) {3 i4 M( ~
var actualwidth=''$ Z0 t6 C5 b" E6 J
var cross_marquee, ns_marquee
+ a# i2 G2 A. @- z$ \ V" m- I' i+ r- r3 q
function populate(){
0 u9 e3 ?6 ~ W$ Z0 T% Bif (iedom){
' F. u! ~9 {1 x9 Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. [/ s9 a$ h; \7 G0 E
cross_marquee.style.left=marqueewidth+8! B: M* T4 Y) A6 h3 b
cross_marquee.innerHTML=marqueecontent
5 F9 q4 G* v0 l" @0 w0 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ _5 E) y8 V* n A1 q1 X' P}
" a3 x) \& l! w. {3 v( A4 yelse if (document.layers){
# T/ K: L5 [' w. F Zns_marquee=document.ns_marquee.document.ns_marquee2
% d4 M1 Y" V1 _' Vns_marquee.left=marqueewidth+8. ?. K* w% V* p- h: S0 B
ns_marquee.document.write(marqueecontent)
( K2 @1 l6 j( D" ans_marquee.document.close(); u8 n1 b4 j y
actualwidth=ns_marquee.document.width
9 _2 H/ A( y9 \; F}
8 C7 X: Y6 s! B3 f1 {8 elefttime=setInterval("scrollmarquee()",20)
- y* F" w& v9 ?0 G9 M P}
& T, ]1 I4 D. h9 L J$ K e9 [8 twindow.onload=populate( [/ h+ d& j% Z; n! V8 l
2 _! Z4 H4 l4 c: G x: ]function scrollmarquee(){9 x' v2 q: Z! \% j5 y3 s
if (iedom){
" t" u4 C- _: V7 lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 g! S9 ~% D, r$ f K. b5 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# Y" f- q# i8 d, n7 c
else
4 f& ~8 n) Z# t5 h2 v5 ucross_marquee.style.left=marqueewidth+8
- I8 _+ z, F* P- P
7 h+ v" Z3 _) x4 G. Z# a}
+ U0 n' U* f3 j1 w9 T1 R+ Q: M4 pelse if (document.layers){! L2 @5 g# H8 y- e& i
if (ns_marquee.left>(actualwidth*(-1)+8))
" i I4 t, O5 i7 Z S2 G& |ns_marquee.left-=copyspeed3 i1 n- X+ b( d5 a
else
7 i( R1 d8 O3 g4 [' W4 mns_marquee.left=marqueewidth+8) i4 P2 o, Q( T8 _2 ]
}* I& d5 X7 Y% U6 O9 k
}
1 @& G" V2 ^. _+ ?1 N
! h% T8 m1 X; V5 Kif (iedom||document.layers){$ k, J2 }) \# g
with (document){' N! T/ X2 l6 D' ]! B* T( P& I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 P0 z. C6 [- u8 u, ~
if (iedom){8 n5 h4 I! t/ \! t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ f& y& }6 c3 L( B# s. T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). _5 \2 `- d) i; M; R6 D( ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, g5 Y! Q b0 b% Qwrite('</div>')4 r7 ?/ a. y4 u6 C$ g& R
}7 x. J9 R% s+ @/ t2 M+ A# w, ~5 ?
else if (document.layers){0 D+ S) b: G+ P, Q; H6 Y; {7 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- L& E" X) o$ Z4 b. |2 s# b6 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); [9 l* Y0 ^6 K
write('</ilayer>')& W# U# s* u! F
}
7 ^- r0 l. K4 U' h1 Rdocument.write('</td></table>')
. X! |) ~3 u$ U! a5 a! q( I}
' u- O" r+ L& \! Y6 [3 U- n# N}5 n2 O6 [, [1 ^! k8 N3 t
</script> |
|