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

|
网页之跑马灯文字特效
//修改宽度! M* B% ^, A, h; B$ j5 n/ ^" {
var marqueewidth=300
; s9 y6 s" s2 j//高度
9 G0 `% [* I+ L6 }6 S5 z" m! uvar marqueeheight=25
( M" ?9 f% S7 n7 n8 u//速度(1-10)% A, {6 @0 `- [8 y, q
var marqueespeed=3! t7 P1 ]! p3 q# V$ _+ f, y7 w
//背景颜色
$ ]4 c) B" q9 R3 P |$ Nvar marqueebgcolor="#FFFFFF"
" n5 |) B5 _2 _; f+ L+ P8 N//是否能暂停 (0=no. 1=yes)?
" m7 l6 z {5 ^# l2 |4 yvar pauseit=16 d% O1 O: r" c
( g# @2 E% K9 c5 M: [! G//修改显示内容% j# B8 \: K5 V- G! R' X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: {0 D7 y( d9 m6 Q0 j# ~. t- H
( _6 h( B$ X$ i: m* Q) ]- c% T
& v ]$ T$ y& Z2 R1 K////下面不需改变////////////! U, I- o: `1 o( i# x" e
6 g- R( c7 M) ^* }
var copyspeed=marqueespeed, ?6 b p6 _2 j$ o
var pausespeed=(pauseit==0)? copyspeed: 0
) ^, G/ q: |. l9 ~9 \; Zvar iedom=document.all||document.getElementById
* M9 G) D6 b- ~/ E% iif (iedom)
5 Q% j1 N! l+ g2 q5 b" Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 z7 k. [ E6 a& v
var actualwidth=''* I- Q- e2 r& ^" O9 q4 D
var cross_marquee, ns_marquee8 X+ s+ [7 U+ `+ B4 i
3 U6 u" u6 g# c3 w8 A: w
function populate(){
' g0 I0 a9 [) rif (iedom){
8 Q* X9 `. h/ ]# y# B! Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 z2 M( F" g( R) e
cross_marquee.style.left=marqueewidth+80 u4 R( d. ]4 I! e; y; L, h: q- M6 e
cross_marquee.innerHTML=marqueecontent3 P( K1 k# ~# J, }- s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 P" a1 t. J) `( v7 ]7 q
}
8 X' E/ A) N9 zelse if (document.layers){$ Z5 [( q) N6 d9 Z; T1 D* q
ns_marquee=document.ns_marquee.document.ns_marquee2# |5 e3 E0 j" n/ t/ q
ns_marquee.left=marqueewidth+8
3 t5 L2 P- S# f- W7 ^ns_marquee.document.write(marqueecontent)% h8 b$ C: O# a6 I8 o( S5 Z
ns_marquee.document.close()
' ~. p/ Q: S/ N, G/ pactualwidth=ns_marquee.document.width6 c2 Y1 `5 @4 I& \0 `
}
# `- w4 j" w, _# R; n. @! ylefttime=setInterval("scrollmarquee()",20)6 x" J+ ^4 h. O: v" O n: Z
}8 Q4 B* P: Z9 Q3 J: A
window.onload=populate/ P0 {) Y/ b8 A4 M
& v5 h! F( b0 R+ R* Mfunction scrollmarquee(){& w' O; b: b( O" N" V7 ]
if (iedom){& S' ?, L0 B$ D9 M4 q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): V% [. @* \4 ]$ R+ b" B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 }" x% M6 G+ T' Lelse
( ~7 H+ S5 _. ?0 W6 z' [cross_marquee.style.left=marqueewidth+8
1 C% t2 E1 h) |$ v% @' _( b; P( W# P
}
% M3 t! e7 O4 { \# m5 uelse if (document.layers){
e$ \/ H( | C3 |: S+ y) K$ Lif (ns_marquee.left>(actualwidth*(-1)+8))% }/ _$ q5 ^" Z
ns_marquee.left-=copyspeed. x7 a: C4 z7 Y; p C! T# P( K
else/ W6 i+ B& J1 g% `& T2 f% a
ns_marquee.left=marqueewidth+8
5 x( k+ G5 J6 N e}' f5 g3 d |( e( B: Y$ [$ Z U+ [5 q
}5 I" n o9 {: M' O
' |7 w8 O- t! f! B r$ l" \if (iedom||document.layers){
- N' b* X* u8 [0 d. s, Awith (document){
) v7 [* p8 G4 K- p) idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 J. t( q( e5 t l+ kif (iedom){
0 [, c5 g0 p8 m0 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% ~2 J2 O% g' M+ A1 X$ ?, T. H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 n% |: J- Q8 a5 r8 d) r5 t3 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 t4 p/ R, M: u3 }& V- X
write('</div>')
5 b1 h0 G4 s! B- F" ]5 v7 l6 H2 d}
+ A% f2 ?9 g' E, R( _- Zelse if (document.layers){
! W- f/ w: D2 w# }- F( d# t" swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) `* c5 [) B! z0 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 r8 @6 L6 s9 K! {! I$ jwrite('</ilayer>')
$ q0 C8 x" w: k7 R9 L}0 _1 g& [9 O# |$ I8 M6 k
document.write('</td></table>')
3 P1 W* A3 u6 f g3 e! H}
" m& y6 B: a: f6 \. L}
" t8 A3 \9 Q o, |8 C# H' B9 ~</script> |
|