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

|
网页之跑马灯文字特效
//修改宽度
$ ?5 z* ? j9 Kvar marqueewidth=300
I1 S) k, V0 m" @( u//高度
$ s, j1 @0 C- q! ~, yvar marqueeheight=250 m+ C1 V* G. O' C) |$ h
//速度(1-10)
3 |# R% _/ C+ W6 bvar marqueespeed=3
! c& t* R; W" s/ a//背景颜色& V2 U1 ?( A' r3 X
var marqueebgcolor="#FFFFFF"" n8 k7 f4 ^# e+ Y$ K9 [+ H9 m, C
//是否能暂停 (0=no. 1=yes)?
) S) s3 e0 i- a/ bvar pauseit=1' G; ?" Z( y$ w6 B: ]
8 ]) H: F/ X; b! t6 z# A//修改显示内容; u. J5 ]0 A! z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ E/ p+ b# t8 h. Y# |" }4 D
# m7 O3 r9 ]# Q" J! a+ A
+ S& E4 F: U" i$ j& K6 z
////下面不需改变////////////
2 s# o0 b" m, g6 e: m, e U5 w! P% L: n/ P5 {: I* k
var copyspeed=marqueespeed
5 }1 Y; t6 v2 ?" U9 [3 P @var pausespeed=(pauseit==0)? copyspeed: 0
, m+ [) d2 t6 e' lvar iedom=document.all||document.getElementById; B0 s6 R0 ] M0 `6 B0 Q/ n
if (iedom)+ ?: X; W k8 z ] d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. c4 @/ J$ P2 l$ E' R' gvar actualwidth=''' u0 `) h3 N7 d
var cross_marquee, ns_marquee; D( f6 \" N) c; I) j1 K$ K1 \
/ M4 s7 C; a, p- H# A* R' Nfunction populate(){ b- Q" F) f5 S" a8 S0 G
if (iedom){7 ]8 g r, k) U5 i. l0 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee ^$ H# y4 G. U' X. n/ i
cross_marquee.style.left=marqueewidth+8
: l; U5 I7 x+ z& ?cross_marquee.innerHTML=marqueecontent
( n# Y) R3 y4 s8 n% r$ x4 t p* kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% c7 x2 u. r# s# Z: |2 r
}
3 B( W- ]% i# q6 C' Pelse if (document.layers){
# }5 ^* v0 a! H3 W( {ns_marquee=document.ns_marquee.document.ns_marquee2/ c3 V0 A3 D" {. Y8 n
ns_marquee.left=marqueewidth+8
% A$ p( H7 w7 ^3 ons_marquee.document.write(marqueecontent)
& Q2 c6 y- g8 Ons_marquee.document.close()
- z) j' {$ l j9 w+ ^actualwidth=ns_marquee.document.width5 s/ I- q4 u1 v# t
}8 h& k+ ^1 d4 b& V' H
lefttime=setInterval("scrollmarquee()",20)& x3 g; b% Q2 y- Q
}
8 Y5 X! E+ Q2 b1 zwindow.onload=populate
! k: `8 q! y6 u2 Q/ z% P, y+ j8 ?8 ^
function scrollmarquee(){
2 [& z: [* N! v e, B) xif (iedom){+ C% m( n: y+ o0 o; E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 S0 {& ?; s$ ?' y$ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 G( \( _# Y! V5 Y0 p
else; {: [ A) E# w0 X; s4 j4 n
cross_marquee.style.left=marqueewidth+8+ }* w" M9 O n; G8 `
. A/ `4 F9 y9 M) A, [
}
! f$ |2 B7 m6 J) `; F3 W5 \8 z- K" gelse if (document.layers){
2 h; |8 W. m$ m# T) |% _3 Vif (ns_marquee.left>(actualwidth*(-1)+8))) J$ V* Q, [' v; H- p& H
ns_marquee.left-=copyspeed
; B/ p. N5 u3 L, s- ielse! d4 m% x3 Y: x, _& B5 ]
ns_marquee.left=marqueewidth+85 N- S5 k; _: w4 q
}
8 V$ p2 _! R! L) x {}
' l3 y; B. i g2 f: _
( E/ R9 H* K; Q* |: }2 ~. a- Lif (iedom||document.layers){
* P# v* V8 ^. x9 G$ hwith (document){5 s0 o7 H- `3 ?' X! h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): }1 `% V8 s" s* ]6 k
if (iedom){: c2 Q* U& D% k, I, K
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 o9 ]( t$ @2 ~, Y1 U4 v1 e' Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
^9 C6 d0 B# ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* V8 _0 Q8 h: b' ~
write('</div>')
2 s0 I+ |% F3 t/ b}
; [5 k) v# j7 s/ { x% Z c7 Melse if (document.layers){) N B- @# n0 H! w: U& D: ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* V( C+ I4 F' o+ e& y, \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 V# [4 w: u1 V1 Y2 A. t9 ]write('</ilayer>')
7 s6 Y6 `: g ?+ A}
/ x# N# H: g# `( [! Q1 l* v! \2 M: ydocument.write('</td></table>')
# i: z. C) r4 `/ d2 H7 W}3 Q% d6 i+ p6 q7 `. o' g* k `. w
}1 p2 s" k. H2 o
</script> |
|