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

|
网页之跑马灯文字特效
//修改宽度' L# Q; `. Z- P" w2 A" j. z% n0 H5 b
var marqueewidth=300
& R5 C* T2 [: G0 _ p/ j//高度
, i4 Z6 }; v- m" o( a8 H; xvar marqueeheight=25
: E# R, D* x5 y l$ }//速度(1-10)
: E3 Q% g* K! m/ |* {var marqueespeed=3
; A; C+ P7 v+ ?1 e# k8 X//背景颜色' M9 n+ v/ q' l: |
var marqueebgcolor="#FFFFFF"
4 |- U: F0 F Q( c* t- f//是否能暂停 (0=no. 1=yes)?
* i2 m) K7 n# N. X6 |0 S" {var pauseit=1
5 u/ {" ~* T6 f2 c* I/ Q+ R
0 I+ e4 d) A5 M+ b% U3 G//修改显示内容* `; G- b. K8 s) _; ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- n" c4 X3 r' T" |
9 L- ~4 G& R4 Z2 G3 g2 q. D4 H. c
////下面不需改变////////////2 S# n3 O( |4 a2 a) a* B
9 V7 y7 G- b* e" G( {% L r
var copyspeed=marqueespeed
n. q- _( K/ t& ?+ evar pausespeed=(pauseit==0)? copyspeed: 06 ]3 J& |7 B! e& |* T
var iedom=document.all||document.getElementById/ a+ n+ Q9 j7 f, K) a6 D# Z' f
if (iedom)
, B9 S& \6 |( G' V, u' ]- Z, edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) [9 @8 N. @: z) {4 U3 o- w# b- U6 Cvar actualwidth=''+ a+ B8 m2 Q6 s, Q. J1 b0 O
var cross_marquee, ns_marquee
8 I* ?# ^% u: K! w" ^: c" `2 S# q, D
function populate(){4 F+ a+ i0 x! O
if (iedom){
7 j7 W0 L9 @- V! Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( Q* { a0 |: [3 F% B5 G S
cross_marquee.style.left=marqueewidth+8
l6 | W* P( q* H4 scross_marquee.innerHTML=marqueecontent
' \" i! y5 v3 Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 ?5 p; `) o5 Q: q} ?2 f' S' B0 s" a% s4 P2 T3 y
else if (document.layers){
: M, n/ o6 ]& G8 uns_marquee=document.ns_marquee.document.ns_marquee2
. z1 @/ \/ p& I1 B! q0 K# Pns_marquee.left=marqueewidth+8
5 I1 Y( p+ q, }ns_marquee.document.write(marqueecontent)6 N, D8 w& \# H% F" g% z
ns_marquee.document.close()
' N3 c- N2 R! W, d5 Q5 M% {actualwidth=ns_marquee.document.width
; |. K ?4 M( ? S' [1 B}
; u" Y& b# w: h9 P" m% F9 jlefttime=setInterval("scrollmarquee()",20)
! Z8 N* N; t h" M( g# U& n}
$ H. ~) {3 _- D! `# K$ @window.onload=populate
5 Z3 Y3 C) t2 B0 \) H" w; ` b# G
function scrollmarquee(){: w: X3 G4 G0 x# `1 F9 C' B" w
if (iedom){
$ d V% V, e! V0 B9 Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- e$ W0 \6 d/ ], f' _/ c. S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: l# t; f' r1 n, K" `- D- T, e
else8 R% \. R' k' y& A9 p7 ~
cross_marquee.style.left=marqueewidth+8
5 b: S' R6 { _1 d. \5 O, }8 z! ]8 }
}
7 m: v! a. l: \& K0 qelse if (document.layers){& F' L2 @9 {& h' |3 X) k
if (ns_marquee.left>(actualwidth*(-1)+8))# C3 ?! f% o* }
ns_marquee.left-=copyspeed( [: V e7 e: k% q' s1 t& r& S
else9 `; B( {1 n* g" _, F3 \
ns_marquee.left=marqueewidth+8. V4 l/ F* e! e6 v. c; W( u
}3 W( U8 N6 @4 u
}. T, k5 z& S( c+ c* F
+ A: ~5 i; x1 H* }$ B: X& C$ A jif (iedom||document.layers){ O( F, y( y$ U
with (document){
' L. m& [0 ^( n: T. _+ Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& N- t- Q$ L8 |' e$ e! ~# F2 Gif (iedom){
. `& B y, g% Z" mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 K7 J$ _, |5 Z. j# r# Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 B8 m1 ?5 H, i) B" c5 ^! Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) \2 h6 t* g E1 D7 h4 xwrite('</div>')
$ O V2 r" n3 l2 ~+ u}
1 Q3 J9 W5 r. |6 n1 w! ielse if (document.layers){
8 c0 E6 ?4 _/ Y: b5 J/ hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" x7 c: M9 N# E4 U- Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* I# Q6 n; n( a& Rwrite('</ilayer>')' ?5 k1 |: ]5 ^$ B/ d9 l8 x
}
% J' M& {: `- C9 {: Pdocument.write('</td></table>')4 u* B9 S; e4 ^1 p# f0 y
}
2 ^! k, q" b+ ^; S' h# b5 M}
: m& i h/ P: d) n8 k8 p# r: t</script> |
|