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

|
网页之跑马灯文字特效
//修改宽度
( E% s$ Z1 m3 G1 _+ a, pvar marqueewidth=300
) g: P( o% l/ C8 \5 D ~2 F//高度
4 @, J* t; b( Xvar marqueeheight=25
1 D: U) p, ^1 F5 c//速度(1-10)4 s1 F ^; t7 ?: X# D
var marqueespeed=3
4 w$ _+ {+ w- Y1 H3 x0 e% Z3 j//背景颜色( O$ F5 }7 j4 p. I% H- ?
var marqueebgcolor="#FFFFFF"
~ o/ n7 }5 Z; z& |3 v9 U1 F//是否能暂停 (0=no. 1=yes)?: s0 E. y1 D8 s% Q) J7 \' x
var pauseit=1
! O7 W9 |9 ^" l* h. M1 B' [" z4 O. B$ i' S2 B3 ?
//修改显示内容
3 Y+ T# B7 t0 @/ N5 r* U/ ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 |$ C4 M# d/ O: c+ B! C( y
$ i, Q- Q9 A0 W0 l% X& H r
& V! a3 Y4 J) O1 R8 y
////下面不需改变////////////$ H9 ^. L( c8 ]2 k. M; T& w' a' ]
. Q. O! L! L* Z' {. I9 Z9 ]5 [
var copyspeed=marqueespeed
7 l$ Y1 @% j, U! y/ M, Lvar pausespeed=(pauseit==0)? copyspeed: 0
; O4 `% @* U8 Nvar iedom=document.all||document.getElementById5 p( I% Z4 s1 [( P
if (iedom)- A: l$ H: x+ C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ E$ d) J) x0 k
var actualwidth=''6 ~) Q9 Z' m( [
var cross_marquee, ns_marquee- r& n* E# c0 G' [
8 S# V5 K6 t4 t0 u* l
function populate(){
8 `( x0 u2 S# vif (iedom){4 ?& j! c1 N9 v/ N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ D% t7 b+ S/ x- F+ Q
cross_marquee.style.left=marqueewidth+8
' m- U6 t. J; _$ f, bcross_marquee.innerHTML=marqueecontent
, Y, G. F5 c) |8 T8 X! X4 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 s& t0 ~' Y: m! C+ o! M}+ x& s& L$ w! q2 m) ? B* T
else if (document.layers){# [3 x) G( a9 u; x7 n& G
ns_marquee=document.ns_marquee.document.ns_marquee26 j* W% ~) e2 q" D; W- t
ns_marquee.left=marqueewidth+85 A3 s% F* K5 R, I1 u8 p: A2 e: t
ns_marquee.document.write(marqueecontent)
" H# i: e7 i4 b0 j! j# kns_marquee.document.close()
8 \: l% t- V0 L. i$ Yactualwidth=ns_marquee.document.width. i; v h+ W) s6 o
}4 R; u7 H1 X# K1 o. [8 |
lefttime=setInterval("scrollmarquee()",20)* I+ v& [7 s- U" b4 i; U" S3 ?" N
}
' V9 _. P8 P. R. kwindow.onload=populate
1 V x4 U6 G3 r4 L6 V! G- N0 n2 @6 n; j' y6 ^# i; K, @9 ^" G
function scrollmarquee(){9 K/ H& G$ [! z
if (iedom){5 @- |3 y, o4 M5 a4 ` K5 q9 I+ v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 L1 r/ H1 N9 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: K" z& o5 J0 C' } U2 P
else
* ^+ _- q" x3 ]$ S2 |' |1 Z" Vcross_marquee.style.left=marqueewidth+8
" m5 A# w7 B3 `
. t" J1 H# p7 J, u, H& g) z" k}) u Y' U J% C$ a; f
else if (document.layers){
* f% S% W; ?2 P+ G9 kif (ns_marquee.left>(actualwidth*(-1)+8))
0 v2 M/ l6 k, w K) c: Tns_marquee.left-=copyspeed
" E$ Q! d) ^. o' E& selse6 g/ `9 u. a. M$ C" m
ns_marquee.left=marqueewidth+8
. F- z7 F' K% ` J j$ ~}
# G( n. W- d9 B. Q}
$ o( ^5 B7 A% \* R: o) Z
4 b3 S! a9 O% ~: t! q) {% Mif (iedom||document.layers){" w, Q) a6 H- S1 C: d
with (document){6 W4 ]3 p1 x3 V$ J5 s2 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% Q' H g5 Q$ ~! T' `1 R7 ~; i
if (iedom){5 }" Q' n, T; H2 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; N2 b6 p7 I) Q' hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" j0 I7 o1 l0 \: I( V' C& t/ q: l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 z* @7 X6 J+ a$ w1 r; |: Bwrite('</div>')
4 ^' H& z# Z' ?; ~}
& y9 O" A/ d Q; w: m- T3 s' C0 Relse if (document.layers){
4 `3 c# {1 @ X# B# ^ Z: j2 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 f' i+ x; B: m0 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 j, n6 n$ w$ l; A3 Z7 C: b: xwrite('</ilayer>')
# t+ B: \2 W# H1 H; d}9 F0 d) N& x1 Z% f
document.write('</td></table>')
% I5 ^) [+ H* ]# e( V. n}" c9 R, c8 o" `2 d, A% D5 E" { H% @1 h1 w
}
3 V% t2 R- T# U9 Q- z</script> |
|