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

|
网页之跑马灯文字特效
//修改宽度
) {. S, N7 t/ b" V! L qvar marqueewidth=300/ ^! `9 f3 M. G; i; k; N, S, i( R
//高度( p& a1 M' d8 p% m" a
var marqueeheight=25
4 _8 p% w+ b, E2 Z5 M3 X& T+ A//速度(1-10)
7 _3 f: W6 v- F. ]; s/ b7 mvar marqueespeed=3
2 \7 @9 W. u0 C( [, g//背景颜色
! y+ y% e: C: z& C) i7 lvar marqueebgcolor="#FFFFFF") k! p( G- I8 Q$ z
//是否能暂停 (0=no. 1=yes)?5 X7 [% L: J7 Y! E
var pauseit=15 d- f* E. m# Z2 u
# w7 ~; o7 W% a, I9 H7 ]
//修改显示内容
( ^! ]# X" p5 p! Y4 k1 kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' W4 K) S+ g& v/ S
: j% k4 a4 `4 f3 q% R$ |2 @
( S8 G! w+ [+ Y% w/ ?( `. q% U( H
////下面不需改变////////////$ Y, ^% |5 K& W- x9 M; D
8 q8 `4 w, s# C9 vvar copyspeed=marqueespeed
3 j9 h# A9 \- s: l1 Q, i% H) xvar pausespeed=(pauseit==0)? copyspeed: 0
# r2 M. M" {6 k L8 C5 y0 y% avar iedom=document.all||document.getElementById
: r! D6 l' _% I" Q0 n5 y- qif (iedom)
+ k! a; w1 \7 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! x4 U, E- v( \' _% J
var actualwidth=''8 Q: i4 _5 u' e. J$ r- h) L
var cross_marquee, ns_marquee
5 R( d9 i& c& L! g- @
9 _) }, T0 f; _function populate(){3 ~! z# t+ b' J' R" r3 E9 S+ ]$ }
if (iedom){
) l2 f x9 D0 O2 Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 S1 z2 Y H$ k# p9 @cross_marquee.style.left=marqueewidth+8
2 q2 C7 y# Z3 Ecross_marquee.innerHTML=marqueecontent
?* y7 ^4 j$ J+ h' y' Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( y" W# a1 [8 e9 K4 s! j
}
, M( i' g5 Z0 a$ A$ l; z0 D7 ]; I7 i, Zelse if (document.layers){* b( u2 z ^0 p0 Y5 o3 S
ns_marquee=document.ns_marquee.document.ns_marquee2% Q* O; v: f1 r2 y7 Y, [
ns_marquee.left=marqueewidth+80 p3 [* u( I6 k
ns_marquee.document.write(marqueecontent)
; u) q" k7 K# E) Y2 e- J' b5 sns_marquee.document.close()4 j+ P% n: C9 ^# o; B
actualwidth=ns_marquee.document.width( z6 c& C+ m! e+ u" p
}8 K; ^. n; {$ g! N
lefttime=setInterval("scrollmarquee()",20)$ ~" z3 q& p/ M! h& X6 H: B
}+ M* C( ~, C% p5 v. }# } L
window.onload=populate+ \. O. U' d8 u
$ F/ J0 i0 y( n, ^4 i/ ?
function scrollmarquee(){
0 j5 o5 \% S6 H: j2 Z: q0 V, @if (iedom){
8 C) g: f4 C, [, ~3 Q7 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), V! v X3 K9 S' m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& \; | i! R# Y% |3 y I
else
' `/ f! y/ G' ~! c( O5 Fcross_marquee.style.left=marqueewidth+8/ [7 @" C/ K% A) I- O9 u8 r
! E* j/ u7 T& z0 W% E3 L# a( d& n; J: o
}- \7 W- f" j8 C* ^
else if (document.layers){
, i% g7 R$ n+ T* ^( B8 j+ H! [# Q$ }if (ns_marquee.left>(actualwidth*(-1)+8))) C; R S4 m8 z k: T
ns_marquee.left-=copyspeed
! t6 K# Q( X5 c2 ~4 x0 }4 T$ V% Melse2 q& }# u6 z% w% _7 v% W. x# |
ns_marquee.left=marqueewidth+8
% c6 @/ Z' H2 ]9 }5 t" b}
! K! U8 X8 j4 t0 W4 L. b; s2 M}8 n- h$ i m- a
: n9 ^- w9 g2 Z+ \4 ?if (iedom||document.layers){
" C! h% a- E3 b) ~$ c$ K" H0 |7 swith (document){! H( a8 J- c* x7 {" F& G N, g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') E9 z6 k5 { J
if (iedom){
! j; ~# i; ]6 m& m7 L7 T$ i% ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 p2 s* j' D/ |- u* | ], i/ T% H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ F$ N: a" Z& h& U9 ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% O; S4 P/ d* s: v& Jwrite('</div>')4 y+ c/ @. D7 e% k9 k% h2 K
}
: |: K4 N9 m5 Z" @1 U! O, Felse if (document.layers){+ ^$ i0 ]+ W) f1 u) z& u6 j/ G5 C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
`8 Z9 T# d8 q3 [' ~4 Gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 T. a! D& _) b3 `, @3 Pwrite('</ilayer>')5 N! `; t0 \. s H! b
}
* ` {6 C1 v! e4 Adocument.write('</td></table>')5 W P+ c/ Q2 ^0 O% N7 R3 p
}: L+ F- X* M# M' U5 ]
}9 [" f+ x; f4 b- `' N
</script> |
|