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

|
网页之跑马灯文字特效
//修改宽度
9 B# V0 G4 v1 C+ yvar marqueewidth=300! R5 c- m4 n1 q, `
//高度! |+ C4 |' y0 d/ B3 X
var marqueeheight=259 b: ?' G8 p2 p% G
//速度(1-10)
1 h4 y/ v# d( `. M; W; @" p1 ^) ovar marqueespeed=3
. ~9 q7 O: a; U! m2 I//背景颜色
4 ]. u& Z4 L& J' Z G f7 _var marqueebgcolor="#FFFFFF"
( ^7 t9 \& K3 J- {2 R4 f//是否能暂停 (0=no. 1=yes)?
$ e$ S1 Y8 q& |var pauseit=1: P: o/ _2 a5 c R. z& x1 D1 H Z1 ^( T0 j
9 q* `1 M$ a7 c! \% t+ l: |
//修改显示内容' E0 U" @& a! P4 p0 H1 C% a6 ]3 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, }; Q6 \2 b+ G/ V9 u5 s
" d7 S( \ \& B) B1 m" V5 c3 a: e0 [9 d
////下面不需改变////////////% U' V" x. x$ d( J+ I3 R ^+ N
/ L7 h6 y8 P) `- {var copyspeed=marqueespeed
1 X3 i9 M& O0 y, D5 Svar pausespeed=(pauseit==0)? copyspeed: 00 G5 K) P/ X; e5 O5 R$ ?! a
var iedom=document.all||document.getElementById8 [& X( `! Y1 ?
if (iedom)
0 \ e! T6 Y; y6 O( sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! }" f0 L; X5 i4 z Wvar actualwidth=''$ h- P! ^( {2 C1 \9 J. r- \0 m z
var cross_marquee, ns_marquee
, b: h; U& R6 I) X2 F& ~3 p7 B/ Y) C* h3 j2 a* v0 J
function populate(){
0 [, ]7 ^; |7 U Q/ `8 u$ Qif (iedom){8 A0 Y6 B) U: A* y8 X; q4 a q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: h& ]. P* ?- d- ~0 H ycross_marquee.style.left=marqueewidth+8
" G9 @2 a, k. ncross_marquee.innerHTML=marqueecontent
5 D5 B6 I0 W/ e. x* Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 t( B0 O6 m# [/ i+ [- _6 c
}! A+ e; r! [9 E# c( Z2 s! l9 U
else if (document.layers){- ]+ n' c' N- g6 d/ X+ p& f
ns_marquee=document.ns_marquee.document.ns_marquee2! b( N8 k5 z( s) I" z" f9 e/ @( [3 a6 W
ns_marquee.left=marqueewidth+8) X; f4 I4 |5 A4 a' m) B
ns_marquee.document.write(marqueecontent)2 |, B. d, k1 `4 s
ns_marquee.document.close()
+ y, j# F' O6 F% lactualwidth=ns_marquee.document.width# [) K' ]$ W6 C; u
}
: e! f: y% T) C; ?4 Z% g2 C! U4 h' Rlefttime=setInterval("scrollmarquee()",20)
, o# J/ W* q: Z7 q* w}9 t- E* N1 D6 f! K+ E( G
window.onload=populate
# x& F# y. S I. l0 O4 {
, o- @! v- `% \9 k% }function scrollmarquee(){
# ?: X; Q, M' @* @# D) V9 Pif (iedom){
% ]# [8 p5 v8 K/ i1 x* Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 ?# ~8 s2 {! U$ _+ M! V$ ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: e" N2 ?' [/ V& t% Y' {
else
! J" s/ i" z3 q( m4 Kcross_marquee.style.left=marqueewidth+89 H3 a5 W) y( }/ f- u, k: B
6 D# B# E6 j. I3 S. G
}, c3 q+ H, V5 ^* ?
else if (document.layers){
6 t9 i; o+ o- r1 rif (ns_marquee.left>(actualwidth*(-1)+8)): u/ |+ W- d! p4 `
ns_marquee.left-=copyspeed
/ Z" D( r3 L7 K! D$ D# r! yelse: }# [1 Z5 d* n8 O1 V( O j
ns_marquee.left=marqueewidth+8
6 H: `: W1 |; Y# E4 Z! X}
9 G$ C0 Q& h# p0 i}$ N4 ]- s9 s8 Y# i
; D- {. N; |. F6 x Q: _if (iedom||document.layers){/ L+ o" Y) V- }& P$ B5 J' ?; [* `
with (document){
% v' h3 N0 U; W& V( ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 U6 L; T9 P; N! f7 Dif (iedom){
) U" k7 F- {1 Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ T6 |( r& @6 t) p7 N! ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# C$ j- z' c- Y# t4 X4 W; O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
V0 e+ d- W' k& _. gwrite('</div>')
" L" O) ]4 [" P}/ t$ m/ M/ D, X* t; s4 D
else if (document.layers){
, m; `2 Y% `4 n) O. Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 ?5 Q" s. P" P8 v* }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* y6 j- c1 D( q8 w
write('</ilayer>')- ]: ^' `6 |5 r7 u( t
}3 F9 _& H9 l) K) E: F& B; e( O
document.write('</td></table>')
- E1 M5 _! r5 s+ P8 ]" Y( A/ d}6 m3 s% M5 A# A1 w) w' @
}2 N- c. k! m8 k" l1 K+ i
</script> |
|