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

|
网页之跑马灯文字特效
//修改宽度% [ I& Y5 v, C( `: l8 D8 c# j
var marqueewidth=3008 } f/ [: Q6 e$ F* a+ |8 z. {
//高度. R4 a ^) W6 n: I% A: u
var marqueeheight=25+ o- E" H( p. y/ X" j3 v
//速度(1-10)
' B/ q/ I3 n; V8 d/ Hvar marqueespeed=3
6 o, f) t" f' K' e$ L6 P//背景颜色
) c0 I# a: T5 r+ T7 vvar marqueebgcolor="#FFFFFF"* E o# p: T% C5 J
//是否能暂停 (0=no. 1=yes)?$ R$ i1 o" z+ @1 R0 F
var pauseit=1
5 f) t' p x. [: Q
" I8 ^7 r+ ^. \//修改显示内容
$ l1 k$ v- V: M% qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 D) [* W( |' J9 W7 m7 T, X- d" U$ Z+ D$ l* I
7 n# d+ [( w7 m1 H7 r; u2 s" v
////下面不需改变////////////
: r/ X7 T$ t$ B9 \! H9 n4 K2 P* E" B- J3 `' b) `
var copyspeed=marqueespeed
* E( g1 t& O5 c2 V. P' fvar pausespeed=(pauseit==0)? copyspeed: 0
; M7 L% d. ]/ l. q7 n" yvar iedom=document.all||document.getElementById K$ s( g; ]0 W: D: w9 v' j
if (iedom)
- n% e; y% O6 U2 r& Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 [5 x1 X* I6 ^; wvar actualwidth=''/ l7 s% e$ A9 F3 z- T
var cross_marquee, ns_marquee) [* i2 j8 ]) ~+ Y$ `7 `
# p' k8 u* _7 i2 H$ Bfunction populate(){
4 C1 T& b; `& c `if (iedom){
0 ]) d) i% J* G+ ~! rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ^; y, Q0 {5 d% E7 y" a
cross_marquee.style.left=marqueewidth+88 y; j" e$ Q" }& y. X
cross_marquee.innerHTML=marqueecontent' I u& m4 e# X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# l9 [, m! H) s9 A% b}
1 H2 d% U* U, C# pelse if (document.layers){) _: M) H( X& w' x" b
ns_marquee=document.ns_marquee.document.ns_marquee2
1 R& L% t' ~' a: {# Bns_marquee.left=marqueewidth+82 t# |: s- B: g6 C6 E
ns_marquee.document.write(marqueecontent)7 @: D7 Z8 Y: b* ?% V( m) H+ ~
ns_marquee.document.close()
[& q8 _: x5 X8 W8 a5 wactualwidth=ns_marquee.document.width+ M2 a/ x3 h% e1 d
}; p$ [. U. \, c! G3 u3 K
lefttime=setInterval("scrollmarquee()",20)
( B2 ^% i/ \$ g# _8 z1 x}
* w8 o" t+ s9 ~- Ywindow.onload=populate5 V2 Z- }, D$ Y) g( G( Y+ H
7 ^3 W J/ S# l/ ~3 u, U6 V
function scrollmarquee(){
4 C- k' u& S8 j& q5 o$ E5 |( Q! mif (iedom){7 g2 h. K/ `7 a N; v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ?3 I* L2 G7 p* F( g# L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 R2 }: H3 k# U9 ?3 Z" u* N
else
. W# g% d6 \5 |, l9 a, d8 f# j7 n/ Icross_marquee.style.left=marqueewidth+8
* s1 \) v [% P' W: w
/ C ]9 C; R) Y9 z; G: R5 @}1 P) w8 P5 C; E. \) x+ y
else if (document.layers){) E3 h5 v6 G- I
if (ns_marquee.left>(actualwidth*(-1)+8))
: {# Z8 t1 U" R5 Jns_marquee.left-=copyspeed
# _ l4 d2 W1 Q+ x' V: U4 Nelse& p- m$ _: K* ]8 L
ns_marquee.left=marqueewidth+8
% A4 q$ X4 h9 q9 @5 _}9 u6 O" H" X# @% h5 n- X$ `
}- L% s: y4 m" X {; R! @# z
* D" T6 C; R) rif (iedom||document.layers){
2 _- u U- M, F+ Owith (document){$ A; e" J2 `4 i9 Y9 i: T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& }) ?' W' ?/ Y. s3 |1 M+ _
if (iedom){
$ \$ Q# n. M6 e- S- ~" q: Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ |* M# |( B: g% Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ d2 `1 z$ l9 W1 f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 Z0 g# D/ {/ G b2 a
write('</div>')
1 E) _5 U) S7 ]/ w% I" S, L}
1 p% G& {: C$ X. l" b* W3 u( Delse if (document.layers){
' Z/ V3 A) a1 f, f. mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 O1 w0 l( m0 n$ a) f) Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) [" l4 X2 [' e+ {. g2 C* H7 b2 ywrite('</ilayer>')
% `& Q& r _0 I ~}0 @1 R2 l$ N' s+ f% L; R
document.write('</td></table>'); }( P# [7 w0 X& N* q k
}7 T0 T: U; b+ P7 s, c
}5 _# w6 g; ?) K
</script> |
|