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

|
网页之跑马灯文字特效
//修改宽度" Q6 ~" b) I3 w
var marqueewidth=300 b7 ?7 M+ ?' ]2 ]8 h4 Z+ ^
//高度" ^/ S% i# U8 V/ X
var marqueeheight=257 Y6 C2 n2 l: ?0 {+ k4 q" P
//速度(1-10)' E+ P% }3 R2 }* R* m
var marqueespeed=3
% h: T/ N; l0 x+ D$ p" A$ E//背景颜色
" Q2 }5 N. v6 c2 J! f3 M! s4 nvar marqueebgcolor="#FFFFFF"
1 ~8 M2 i5 U& O+ m' [- B; Y* e8 C//是否能暂停 (0=no. 1=yes)?! v) C, a9 N6 n
var pauseit=1% `9 w3 @! O4 a5 @8 ?" @0 v
( N# ^; q9 M3 k! u2 a" | I$ R
//修改显示内容
. q3 ~0 N% n; [5 }# J/ Z4 Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 ~2 }! p% L4 Q1 T% A- {( k
0 K. M; f8 Y' ~" Z/ ^+ `! k0 Q+ f7 B7 l( u4 M# U2 J/ v) o) H$ W
////下面不需改变////////////0 c/ M: V. @8 K
; _6 A# B: B. Q1 @0 Nvar copyspeed=marqueespeed
: s4 y+ k7 f1 r1 Zvar pausespeed=(pauseit==0)? copyspeed: 0+ ]* n% r! K! G g' _
var iedom=document.all||document.getElementById \+ E' U' B/ K- F' k
if (iedom)- D8 Y" z6 E7 R4 A& f' C X% J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* r8 _% \0 A: s1 g) t0 i" \var actualwidth='': N, L" H1 N' l2 T/ `* s% ?2 F( M
var cross_marquee, ns_marquee
$ Z A9 |/ x# ?! I
0 r& M& V4 G# C" F: [function populate(){$ M6 k+ c8 S7 I: N
if (iedom){' M- s4 b1 Z/ D7 Y) x! ?9 T3 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, Z0 t4 a {- j! Q3 Dcross_marquee.style.left=marqueewidth+82 q6 |4 D7 O2 H. C. Q7 z9 z
cross_marquee.innerHTML=marqueecontent
9 j- Z' @2 f4 ]& v; wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 {2 }8 m' y# n}
' j5 v7 ~- K/ P) melse if (document.layers){
0 n) z& b6 A( [( Rns_marquee=document.ns_marquee.document.ns_marquee23 U0 `$ q9 g0 k# e U
ns_marquee.left=marqueewidth+8
( ~2 _; a) I5 `+ @% }# i; |! ~* ?2 i9 [0 b Bns_marquee.document.write(marqueecontent)
8 y( Z2 s V: Y2 T( c/ A% cns_marquee.document.close()
" Z r3 { s! m+ g+ O0 p' G2 Pactualwidth=ns_marquee.document.width! m% X* `* l6 D' T @
}& p; t/ g2 K1 @: N; `
lefttime=setInterval("scrollmarquee()",20)
; ~9 I, }; b' U! o' K}/ ?( g* m4 F* L) T* W
window.onload=populate
# W# Z7 R) |- ?2 M) ~) l" N: B3 s& |
function scrollmarquee(){
) h2 I9 L+ v9 C5 \if (iedom){/ y0 A. ?$ l. O9 l, ]& s) U+ v& L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 p4 E1 j" d0 V7 t6 C( j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' c4 _3 ~" X, S: O# }+ {else+ k6 _, _5 ?% m8 r
cross_marquee.style.left=marqueewidth+8+ u+ q" K7 M k/ t( I
6 n+ R( }! F* U1 b" E
}3 t9 p8 `0 q* b7 P, C7 l: F
else if (document.layers){
/ G1 v* D$ z2 N# `7 T$ V5 M) [; qif (ns_marquee.left>(actualwidth*(-1)+8))! n* ^( O: h$ K1 B4 D/ {; h o- }
ns_marquee.left-=copyspeed: C, t4 \9 \+ y
else
m5 S, e: W. d7 J2 m% H! Lns_marquee.left=marqueewidth+8/ a4 P" g! f8 W* r0 D
}0 |1 S1 U5 V V8 ]3 F2 ~- B1 ` B
}- d0 S; ^* K/ m) T: b2 S
% Z0 C# B* x; j y
if (iedom||document.layers){& q2 c6 g& y( y3 b! g& p6 l; e
with (document){1 u" e7 ]& n- R% T! y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- m5 W' L/ T) Z5 X8 mif (iedom){
: d9 q6 q2 z7 m5 |0 C% ^+ L' twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' w$ h! `/ W0 V' f# O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 A) }9 N6 B( u0 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& ?# X* e. c7 B9 Q% W
write('</div>')! l# Z( v+ ?* n/ E
}
2 N/ b7 ^6 w+ v; S* Z* b) Velse if (document.layers){3 Z$ l; C$ r& F+ J' q4 @5 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ `: {9 U6 j- ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* u7 q7 r; s9 n$ @; a. \write('</ilayer>'). d# \4 x" u, Q! O3 ?! @
}" k0 x: ]% F; ^! G+ g, F$ b5 y
document.write('</td></table>')
" s1 Z2 b+ t7 Z2 Y$ v& v}( G( ?. C" Y% D0 v9 o- P" R
}
! M) r& L# ?. [: @6 Z/ ^</script> |
|