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

|
网页之跑马灯文字特效
//修改宽度
7 |# K! Q& g3 y. a0 t M0 Jvar marqueewidth=300
; _7 G% U l: r& j" R9 S9 p//高度2 U: X' c, F& }8 `" n0 ^( p0 e
var marqueeheight=25
2 b' T8 W) X" P1 |6 o- n//速度(1-10)
3 X, I% }" L# ]3 hvar marqueespeed=3
B" C& Y4 L- x8 l! G: y//背景颜色0 D/ j/ l# Y0 _! l5 `
var marqueebgcolor="#FFFFFF"% S1 t" R6 k. q: d+ z: l
//是否能暂停 (0=no. 1=yes)?
1 m. `- W Z3 s) }" U; }7 Tvar pauseit=1
; @2 V5 x/ U- u
0 s& z! h6 ?, _. L! y v% j" _3 [ w//修改显示内容
1 s$ q: K. l2 H Vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 g+ S9 }, h+ o. B, k2 l8 b M$ f% m9 e6 N4 J) o
. j1 i" y- B, O////下面不需改变////////////
9 k! g8 c7 }7 v' s' R' g( v' [0 [& g. \ X
var copyspeed=marqueespeed
2 [" u7 }7 d4 X: F9 i$ A' ~7 Kvar pausespeed=(pauseit==0)? copyspeed: 0
8 B/ \6 } o4 a, p+ Bvar iedom=document.all||document.getElementById
6 ]! b' ?/ F, y, uif (iedom)
5 c. g% y* X$ ~7 Y9 ^' idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), s9 s( n6 L8 g4 W9 _1 W
var actualwidth=''4 k0 U0 h c& u* H& b) M- E( T
var cross_marquee, ns_marquee
9 r8 ?% \& g# O: G" _ F) }' D2 `6 {! D0 ]
function populate(){
1 e% E( `5 c) _% L( q# ]if (iedom){* q% g G1 |! M! c2 g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- G. a& `" i0 D) L2 Pcross_marquee.style.left=marqueewidth+8. x( B; `( _* [6 {
cross_marquee.innerHTML=marqueecontent
6 V$ h8 W0 g+ z; cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: O- ~& B: X0 o3 q}* M; p$ |9 [4 g0 J' F
else if (document.layers){
- _4 J) X" V/ n) L! B; pns_marquee=document.ns_marquee.document.ns_marquee2. s) x5 O! y' S1 j# Y1 a+ \, C
ns_marquee.left=marqueewidth+8
* N: j2 z( K2 r& E$ y8 Dns_marquee.document.write(marqueecontent)
6 g$ I+ s+ |; S& ~ sns_marquee.document.close()6 Z6 E4 L1 E% ^" k2 X a% W" a
actualwidth=ns_marquee.document.width2 G) {) Y' C$ _+ T
}. {% H6 K0 W, p/ ^! T& k/ R
lefttime=setInterval("scrollmarquee()",20)
& O. k4 c& q. Z0 v2 d9 X* G}
1 [0 D8 A2 t2 m/ Fwindow.onload=populate
3 |! P0 @5 r4 u7 A V* g/ z% @2 g, P3 w& { U
function scrollmarquee(){2 ?- z1 N# E! y
if (iedom){
3 r2 ~4 h- s/ {5 S- Z! T- qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 M8 D2 ^( K- i- L6 across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( O/ |( p; g& {2 L$ A9 u" h1 n) W& Jelse
+ }. V1 N1 l7 F* _- p; ~# \% t8 f$ @cross_marquee.style.left=marqueewidth+8
$ h4 ~) z0 l& |* N8 T3 W
& b! l2 Y' }2 s; ?3 }' W$ I}+ C" ?* T! t( y) y! Y
else if (document.layers){7 N: j' I" U/ v* N) A( s5 j
if (ns_marquee.left>(actualwidth*(-1)+8))' R) s8 K) Y- d2 Z' B6 s0 L# Q+ E- F
ns_marquee.left-=copyspeed
8 p8 Y! U% }* Y/ Kelse2 _. N. G; Y9 h- n' x) ` `
ns_marquee.left=marqueewidth+8
4 D6 _* S. P9 c& }, S}9 J. U% E( Y) k! ?7 L
}
* _" y: S9 G+ R: v. G/ O- w# k0 t9 I' H6 D: }4 O" M. X7 e
if (iedom||document.layers){
- s/ F) s# L$ D4 K# Z, r9 rwith (document){
; w$ @& `! _/ S$ _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- l7 K; N" D- r0 t7 E" A+ ]
if (iedom){ h5 Y- C2 D+ j" @. V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) \. Q" o4 _' ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% O! y" w& ~$ bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 f- G" g e7 V7 g- ], [4 v
write('</div>')4 L; V e h. B0 J! x$ X
}
# x9 I1 Z+ u' q* |else if (document.layers){
9 G% C, e" l$ R- O5 o" `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* w+ ^8 r/ v7 \% p% M6 ~3 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 M/ F: l$ L: A: N% q
write('</ilayer>')
$ U, v# F1 g, E& D. S5 M$ J4 N; A0 i}
) s. n/ J! l i0 adocument.write('</td></table>')% U- f1 ] o& B+ i1 J; M
}
+ f% D+ j. w; M$ v% V% r}
; b7 i6 \: K$ [5 X</script> |
|