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

|
网页之跑马灯文字特效
//修改宽度
5 g6 X* t6 T* n1 |, A7 B9 ~4 Pvar marqueewidth=300
E6 p& x" j& d! U. h4 `8 f//高度
' e% G ] W6 ~( G7 Z1 o" fvar marqueeheight=25# u1 S9 [2 I* [2 Y$ p
//速度(1-10)( o4 m9 f7 c1 X+ E: N* ?$ l8 T+ F& m
var marqueespeed=3; b: f3 b# N K& `4 b
//背景颜色2 N3 `" S" S) A4 D
var marqueebgcolor="#FFFFFF"5 @7 @$ x8 d0 G5 r
//是否能暂停 (0=no. 1=yes)?1 C4 p& E6 w! |* S
var pauseit=1
% D ~. I0 m- [7 s; ]8 c; l6 N( s, B6 w, V0 H5 P& [" m+ J' V
//修改显示内容
1 i9 p( X& L4 }% Y" k9 j) ~* Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 M a: H* m. x
0 ^) e1 q8 P3 W4 P" |7 u
$ T: L, s P C# c
////下面不需改变////////////( e+ x1 U3 p. x) f1 k, P
5 d7 p% U' h7 X a7 Avar copyspeed=marqueespeed
& A, ]4 N+ k3 |/ Dvar pausespeed=(pauseit==0)? copyspeed: 0
+ H/ j' q! E* c8 _* Yvar iedom=document.all||document.getElementById+ `& d" \9 u3 {9 l/ O# E" m/ K
if (iedom) [6 V: g3 S8 ?& V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 A! j6 i5 O9 o& mvar actualwidth=''& h( Q# v/ K% t9 Z7 p! L4 T
var cross_marquee, ns_marquee/ w3 K( { y- z5 @0 U3 s
& D6 F& U" o# B* `
function populate(){% @3 |# N( r) s& A& t/ S
if (iedom){5 e) ] |: b. Q) K. _& {8 I" e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( {, r8 d; u# ]1 D. F
cross_marquee.style.left=marqueewidth+8
; {+ m2 I: |" ^. }" z+ @% Tcross_marquee.innerHTML=marqueecontent
9 Q6 P L6 Q% y$ ~6 ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! k/ f/ W' o, d+ ?) a}
3 e2 }9 b9 k- L6 L( Y6 Y( v0 gelse if (document.layers){
! a% N! o8 X/ dns_marquee=document.ns_marquee.document.ns_marquee2 c( S n v# C1 U
ns_marquee.left=marqueewidth+8
# n$ a' W& w B! b' V5 l! `. c0 z/ |ns_marquee.document.write(marqueecontent)
; Q6 y- c! ?6 t0 d; }! ?/ w' ^& w& E% ~ns_marquee.document.close()
7 Z& s4 c) H) x* ~" B7 p* o6 Hactualwidth=ns_marquee.document.width" G5 t* g3 K/ O# ?. {0 \
}
; _# j; t' N- w$ Ilefttime=setInterval("scrollmarquee()",20)
1 Q+ s7 W7 S. a1 U5 p9 ^, F}; y5 l9 a) J3 L6 \1 ?
window.onload=populate
8 m1 n4 T4 Z0 R+ \; p V
/ V% x/ {$ y# d( b: U+ S- E1 w4 zfunction scrollmarquee(){! x* R, M, o2 V9 ?4 P) w
if (iedom){
& d3 s; W- v/ s$ X- fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 y/ ]: F" ^! k+ `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 a! c9 E1 G$ ?9 Z( {else8 D1 R6 l a) I# w1 ]
cross_marquee.style.left=marqueewidth+81 f @9 L* }3 D; d( j! l4 j9 W# t
* `- ]9 S1 m% X& ^+ H% v; t [}
h5 t7 u, C& s/ g [else if (document.layers){& G" Q$ x/ }. E8 e2 l5 S% D
if (ns_marquee.left>(actualwidth*(-1)+8))
U3 f- g% u% p! j" D' wns_marquee.left-=copyspeed
* K6 a6 i s8 G- P. |else- Q' U0 N V: N$ U+ A, I
ns_marquee.left=marqueewidth+80 U& a- h- W' G% V0 M2 H% B- h" u* j
}& S( X4 }, Y0 N& \
}
0 l7 C2 e0 w8 D: G8 Q9 D
8 R, y( q" F. g# p* nif (iedom||document.layers){6 d( v/ c% F5 c* v
with (document){5 [. a# c, n1 M9 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), ?) C6 d1 Z n9 V: E- ?
if (iedom){0 S9 }1 D9 _! x- l( s; V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 Q- }+ u* R O# ^& ^# {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# h& M" ]! t3 q$ e4 j
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 o- y& e, W8 y. H+ `; I$ ~write('</div>')% d. y& [3 ]) ]% b8 ^
}
. `+ r6 T; b! ^. x# z$ Eelse if (document.layers){* L7 c1 q+ k, W T$ A0 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* E% Z% O; Y3 w* p) }% ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) S2 b$ _! M/ J) Z7 @
write('</ilayer>')8 C5 |" s& L: t+ m
}
. Y% B2 C- O6 |. \9 odocument.write('</td></table>')
" m ?$ c. D* Q0 W& \% w}: j- o) F8 q: h: h" L
}: ?8 E3 O. K( h* X+ R
</script> |
|