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

|
网页之跑马灯文字特效
//修改宽度3 h" f% G5 L/ H" a+ S+ o
var marqueewidth=300
/ f2 o: A. W/ @- F, ~* _//高度3 C7 @0 Y, Y$ _+ P" P; N
var marqueeheight=25. n0 S( f/ @; R" ~2 k+ i
//速度(1-10)
* Z, J; p. ]! Y& J0 |var marqueespeed=3( c7 W4 y9 k4 w/ S& I- P% f
//背景颜色/ p! d1 j. }! _! I( `
var marqueebgcolor="#FFFFFF"
- ]5 z' G8 t }$ k/ _/ g) v//是否能暂停 (0=no. 1=yes)?
: x; Z+ \: r! Z) s* L% Rvar pauseit=1" Q- P2 C8 ]- {8 C$ c# `
- P5 X$ Q/ ?; Y' c//修改显示内容7 T3 |6 u1 ~. q0 n/ B* z3 F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( ?9 a W5 f9 {4 {9 ?1 p
. ^6 N# ]# i3 A7 C: ~! w4 h6 h, D2 H5 _; n8 ?% l: o
////下面不需改变////////////0 P" Y8 P: b* T4 j
2 I6 F1 X- c4 d. y5 svar copyspeed=marqueespeed- I* |* D8 R* m3 ~8 I
var pausespeed=(pauseit==0)? copyspeed: 0
3 `+ [& L9 S0 _# tvar iedom=document.all||document.getElementById
) x* b6 {. T- X3 Sif (iedom)
+ Y1 F( ~! P8 C5 C2 Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 K; P9 g/ o( o& avar actualwidth=''! G# }; ^0 N8 X! M7 C2 I6 V6 |. {
var cross_marquee, ns_marquee
( n' `; S. X w. j- o8 ^; A5 V& Q. C3 Z# O1 t8 p
function populate(){* c, f$ `7 |+ Q) Y$ H* b5 s& {
if (iedom){. u# S5 X6 x7 E; ~/ ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' _4 E6 H8 W% e2 V- U* O
cross_marquee.style.left=marqueewidth+82 {- G5 j7 _- [
cross_marquee.innerHTML=marqueecontent. D+ Z5 Q8 m% X% M& Y8 v' t; J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& |8 a4 U" ^; e, f}( F% x k" R! c: s* X/ W
else if (document.layers){
2 f) m: k0 A5 b7 V2 }# }- S. Yns_marquee=document.ns_marquee.document.ns_marquee2: Y) g. O! q( V' k2 I7 }( W
ns_marquee.left=marqueewidth+81 Y! s" N! H. W( A* U
ns_marquee.document.write(marqueecontent). q' d l0 | }7 P( [$ G
ns_marquee.document.close()
, A& w4 T- N6 V+ q& z# S( Ractualwidth=ns_marquee.document.width
d& C8 A( I1 Q4 [/ z}
& n {1 e U; }0 ^% e8 T3 clefttime=setInterval("scrollmarquee()",20)
. N+ r9 q/ I/ f5 F}
/ ?# u# h3 K D5 Awindow.onload=populate
3 o5 M6 ?6 A' G# S& J
0 u+ y! i& }2 U# T$ A0 n$ t: t/ d& _function scrollmarquee(){
- O9 v% h5 S* w4 v6 qif (iedom){) ]; A( |3 x' b* Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ S6 t& E4 k2 g' b- Y+ j( s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 _5 {5 a, [+ }else* V: z& O5 N% b3 R
cross_marquee.style.left=marqueewidth+8; s" j6 |. d6 l3 q. F# q5 S, U
5 f" M5 \8 g: g5 j' g
}; a2 a) W! [0 z4 q, F1 ^% P
else if (document.layers){* ~$ y0 T" j9 Y$ m, V; x1 N
if (ns_marquee.left>(actualwidth*(-1)+8))$ o$ {+ @6 n# {, d0 M
ns_marquee.left-=copyspeed
6 _4 S" j# Y# P5 `& Kelse9 b$ \) v; W" q) J1 x; ~4 Z
ns_marquee.left=marqueewidth+8. {" t) k4 O) |# W4 ~
}) ]4 M5 v2 _9 R* [
}% D- A3 \$ V- {
0 y& T. ~" e: E a9 F
if (iedom||document.layers){0 n, r. @0 t' m3 M" l0 B+ H' _5 |
with (document){
% M1 _8 m; Y$ {/ f4 V g& Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, z4 T# z, y( s. {4 ?4 ?0 F$ hif (iedom){
' |. E! b2 [4 e3 Y/ H3 ^# m6 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 o' C2 T* J+ N, A4 m! ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; J- c0 C' J, f3 @, [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 f1 o+ J* T/ X$ l" pwrite('</div>')
0 p7 ]0 B* `% e4 w% z5 g0 C}4 `* z6 ?7 l' K* }
else if (document.layers){% ]5 A- }- {6 {3 a8 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- s2 T% C7 ]5 a) f8 K" O1 o0 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# C: w: L( J5 } g) C9 D
write('</ilayer>')3 K; f- N# U$ l0 p+ X, s
}/ x) _' Z" W: R' O5 ^/ H ^
document.write('</td></table>')
9 b# W+ u$ }2 k$ x+ `: F3 q; l6 x* p}, Q) {( T$ n! g# ]+ t
}
2 K! V" k; Z. ]. d) Q- r. F, e y</script> |
|