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

|
网页之跑马灯文字特效
//修改宽度7 V( L! O% g( [
var marqueewidth=3004 x# k' [! w0 N( U2 W
//高度
" f* B/ p. I" ^* U5 Q" Bvar marqueeheight=25
. ]1 K- B& j) w2 E) s. B/ t8 h4 `//速度(1-10)
6 t; q$ M1 i9 R4 }0 vvar marqueespeed=3" a a* P7 `/ N5 D' r R5 B: B8 q
//背景颜色4 {& [7 O6 Q7 _& i" R
var marqueebgcolor="#FFFFFF"
" Y7 T7 `* _. p: t/ O2 u//是否能暂停 (0=no. 1=yes)?
* j; _5 f! w6 I8 e- L/ vvar pauseit=1
/ P1 X$ T3 D" t* P% s$ T! V6 f/ C' g" A6 _# T- u
//修改显示内容* H: i6 z1 q+ R( J! v: t/ ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 B! N& h3 e, d; p
1 \. N3 B$ _1 N$ H p! U9 X
4 p8 h- U- j$ k3 E9 ~
////下面不需改变////////////4 V9 k1 f- }+ P6 z; p
3 V7 ?) ]$ \7 O) E
var copyspeed=marqueespeed
' \9 `+ d+ [+ ^0 N6 m0 svar pausespeed=(pauseit==0)? copyspeed: 0, F* j1 i8 |8 H) V4 I. v8 c
var iedom=document.all||document.getElementById; [% M% P+ L" L+ w1 B: l1 }2 y
if (iedom)0 b: A% ] X7 R1 m- W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 w! `8 [, z$ B$ S$ N4 ]: a1 ?& fvar actualwidth=''
* x( {4 N; p- n1 E) Zvar cross_marquee, ns_marquee
' m4 o, J1 y- w6 ?( j- P1 T" \) {; f* b; y V y3 Z& y* M6 h
function populate(){6 n* Y, F3 p$ w# m- ~
if (iedom){
6 E0 l2 u: d2 Q5 Z( k9 V9 y* xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. b9 l7 [, v( g9 g5 @
cross_marquee.style.left=marqueewidth+8 v! P& T9 ` }$ d/ d$ v! a
cross_marquee.innerHTML=marqueecontent
8 i1 x6 V) m) v5 b; p! i zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& o% a r6 ~( q t8 N% z
}
: Z2 c: F# r& ielse if (document.layers){+ R) b+ A+ Q; q' b2 }- \* b
ns_marquee=document.ns_marquee.document.ns_marquee2 v- E4 ?7 ?* T7 U# Q% w% a
ns_marquee.left=marqueewidth+8# F% D% A; k; Y# M$ ]: C4 _
ns_marquee.document.write(marqueecontent)2 o) R$ _7 u4 R2 R: {
ns_marquee.document.close()! d% R6 j- ]; O
actualwidth=ns_marquee.document.width' Z2 Y# t, c; {; B/ T
}
- ^7 y l4 j) f# B$ Q) `lefttime=setInterval("scrollmarquee()",20)
3 k+ H' {: E2 _2 A" u}4 ?2 _9 U% D7 X P
window.onload=populate
; a! M9 |4 W* D5 z6 V7 C9 v2 F0 v) P2 D9 ~/ Z
function scrollmarquee(){
. B9 r6 ?' {( w* Yif (iedom){+ ^4 x: y/ H1 y$ [9 v; f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! k6 l/ e5 P( c. O, t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 N. \5 H7 q' w& uelse
. X: e3 U) H0 W1 \0 r" `7 V( t# kcross_marquee.style.left=marqueewidth+8 I0 g, [: c. X6 V/ h$ G) E
2 S7 b0 F2 N) n) D6 `6 ?}7 g) G# X, o+ {0 i
else if (document.layers){
2 ?( I0 q) b7 z7 E' yif (ns_marquee.left>(actualwidth*(-1)+8))
2 c% _9 {% a) Ins_marquee.left-=copyspeed# _2 l, r& P$ ?+ v
else
3 F% D1 ?+ s8 W$ cns_marquee.left=marqueewidth+8
( r# W0 M7 e0 u! k( c) d6 d9 a5 P}( j0 v8 Q! s; w1 [1 \. j
}
/ T8 M) D' R: p5 }% P
. b, @; `4 K/ h) I9 aif (iedom||document.layers){
; Q$ c7 c. r$ p; a/ uwith (document){
3 m& v& Z& ~) fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( \# y( U$ P; ?1 w9 P% a% T/ v, r
if (iedom){
4 B$ K' H0 Q, v; H: f$ qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- F5 n1 P2 M) v9 dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') [* H$ r5 E( Z. F% g: T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& }7 k1 H2 _6 A) Y( u1 O8 Q/ ?write('</div>')$ _3 d0 F3 c) l) h
}" X( R; X* V# p
else if (document.layers){0 h% ^ Y5 i& M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- u: Y/ Y6 F* {7 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 T% H& A- h8 O9 f+ e& M2 e! ^
write('</ilayer>')
" B5 F( p8 b; ]" B}4 L6 o, D6 n& \2 V/ I6 ~$ T
document.write('</td></table>')
% q6 c1 X( o& w( K- v) |5 A; f}
$ e& g0 [2 l3 C& o+ i4 l' I}
2 d+ _1 \3 k/ ]/ E</script> |
|