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

|
网页之跑马灯文字特效
//修改宽度
" a |9 `- r. Qvar marqueewidth=300 k3 l) d" b# g; q
//高度" K x2 w9 C" `% D1 u: E* b
var marqueeheight=251 C: H+ ~- [3 A4 S+ ]4 p; v8 R
//速度(1-10)- p0 W- c9 M7 W' J* V7 O# `
var marqueespeed=3
5 D% S( F J" u: D//背景颜色7 ?7 d- q E8 e) l) V* s( f: c
var marqueebgcolor="#FFFFFF"
! _* V8 J8 e X: W, v//是否能暂停 (0=no. 1=yes)?
" s# ~; j* g' i- Y! K! R1 @: uvar pauseit=1" u/ Y- G0 A' G( `
; n0 O$ I9 u. X0 |. {
//修改显示内容
$ V6 u/ Q$ p( j5 w# xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 I& H$ C8 F: x6 |1 [ B
4 c& d) n+ }7 U9 k \0 V+ B1 Z/ k" g' E4 F
////下面不需改变////////////9 ^( d. E5 q7 r
, B) J# Y _/ |( a3 N7 `) C
var copyspeed=marqueespeed
/ @+ e) ~ u" N9 hvar pausespeed=(pauseit==0)? copyspeed: 08 h9 a% ?% z, o# w* n, ]- k3 h; J
var iedom=document.all||document.getElementById$ i) t9 L7 F6 a9 w4 n$ \, a5 |8 H
if (iedom). J5 I) e+ `' x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; R; H7 ?; u5 Xvar actualwidth=''
5 M ^+ \. B8 z- Q! Xvar cross_marquee, ns_marquee. Z2 a( J; j1 v% T
* S a& L$ _- g1 ^. P+ X8 w. d% m
function populate(){0 I2 D: v" H, v6 x+ O2 W! k% N
if (iedom){5 u- o8 a. K. p5 L3 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) h4 y! L7 P$ c# H: ocross_marquee.style.left=marqueewidth+8
9 |0 V/ v8 }" K* Fcross_marquee.innerHTML=marqueecontent+ V) ?: j; H0 z0 J7 E I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 O( d6 X4 R! u. P: \/ F}
$ `6 i& Q/ \9 o' Z2 P3 velse if (document.layers){
. a! m5 ^; O& W3 _7 P: m8 Dns_marquee=document.ns_marquee.document.ns_marquee2
8 y" c* Y: C0 vns_marquee.left=marqueewidth+8
1 d# P8 v; A3 sns_marquee.document.write(marqueecontent)) x9 e1 R9 r3 |; Y# J
ns_marquee.document.close()
. d1 l* ?% y" U, Uactualwidth=ns_marquee.document.width
, \3 N+ f9 c/ P7 u1 P- z5 B# s}
! @6 \0 O6 Y& J9 k, clefttime=setInterval("scrollmarquee()",20)
. Q! k& ~6 y. A. z# S+ }' s}- \5 h4 H: U/ |- u G7 G8 z
window.onload=populate
: ^8 t: g6 m" h( C% a% s' i
: M$ \1 O h3 |$ r# t' `" sfunction scrollmarquee(){
' [# o* }* i) l- K5 ~; Gif (iedom){6 H" I. P6 k2 b! w" l5 {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 {" d, I' K2 }/ S$ Z: g, x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. y' ~; s7 A7 e: j9 m# [
else3 }( \1 h. ]) s2 T8 B4 N
cross_marquee.style.left=marqueewidth+8! u9 ^( |5 l* }8 s
1 P7 x- u7 g8 c- X2 i8 V7 D1 F3 h
}' Z0 O# q& h6 T- X
else if (document.layers){# p9 f7 q1 a# p. a1 r/ M
if (ns_marquee.left>(actualwidth*(-1)+8))
- q! g. v3 a+ b" I0 Yns_marquee.left-=copyspeed n' [3 A7 n; G
else
- s# b2 w+ H; J* t1 \: ^- Fns_marquee.left=marqueewidth+8- x7 M5 l; T7 o1 C5 ?
}) j% S3 X7 h* B8 I7 p
}
) s+ t3 A7 k3 n" T9 @& s l4 w; D6 }# s
: N: O* _5 S1 a8 e+ b' pif (iedom||document.layers){& ~; X3 P' K+ t( |
with (document){: }: ]- I$ M6 M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& Y; E# X% m g5 ] v! Y0 A
if (iedom){/ d( x2 |1 _3 q& h3 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( d: H8 v9 U' e7 a7 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( S @- U/ O: v( ~8 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 C% z' K. \, W. c8 s# z/ |1 v8 ?( b
write('</div>')
k6 L K. ^2 ?9 z1 k+ V}
. a0 Y$ `6 W8 l3 Pelse if (document.layers){
1 C- ^& y/ s* fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 x$ G1 |' W" v. U2 swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ r) {$ t8 d. Kwrite('</ilayer>')
2 Y$ ^' Y* }* A$ Q}, R5 j7 [8 Z, l. Y: P
document.write('</td></table>')
3 o( J9 E0 \; N8 k! ]* w1 F% O}( X3 @8 x$ k, J. T/ R; _: w
}
8 B& d9 [6 N' d7 J M- G; @</script> |
|