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

|
网页之跑马灯文字特效
//修改宽度2 F2 [# U1 `( M' J% w; `- K
var marqueewidth=300& q7 c: n& W# q/ P! \+ p
//高度: r& A* W2 j( J9 _' Q& k( H0 v
var marqueeheight=25. _" `/ T. o4 f( Y o1 k& B: S. ]- m
//速度(1-10)
3 a1 G/ a+ _6 M3 ]9 c/ v4 i. avar marqueespeed=3, T9 [& _2 h# r) h/ B; ?
//背景颜色9 m0 e' k( b* V2 m, V
var marqueebgcolor="#FFFFFF"
8 C# Y% x2 `& L" B# Q. m) X; E//是否能暂停 (0=no. 1=yes)?
) q6 Z z4 I1 bvar pauseit=1
& q5 n9 }6 w$ v, O( [) M$ x
! m! d1 p% @: F# W//修改显示内容
; q1 \$ w: L/ J3 N0 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 ~% C# G2 i2 _1 K
, v* q4 T+ k0 V v6 I
* {8 [0 w9 Q# `# w
////下面不需改变////////////
' ?- |1 O9 ^: P2 H7 {7 A/ F* A2 a& l) A: K: F
var copyspeed=marqueespeed
& E! A: Y! Z! I$ v) R. lvar pausespeed=(pauseit==0)? copyspeed: 0
9 ?+ y ?5 @ {- ~, O/ Qvar iedom=document.all||document.getElementById* b( O& r7 s; u- b- Q. V
if (iedom)) f' y1 ?# \8 l7 K# J8 a9 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ T) E5 K) H/ \4 t' l! w
var actualwidth=''! p; Y0 C8 t5 H* E3 P. K) e
var cross_marquee, ns_marquee
6 y) P# V6 o$ h5 s2 X3 Y+ X' |
" `2 t4 p3 _3 m( `8 zfunction populate(){( O v) \9 o' n4 c- t
if (iedom){, r) f3 T2 A8 m: J5 B8 a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; d6 C0 [# H+ m7 G4 D5 p& across_marquee.style.left=marqueewidth+8
" W, u; h, C9 t& Y3 i% C: D scross_marquee.innerHTML=marqueecontent
z7 `( L; |) ^; c+ W( C- _# `2 b" sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 w, H D, ~6 K$ j+ m}
9 {/ N+ O0 ~9 w2 w3 q1 j6 _else if (document.layers){4 } T' a- r0 i: d5 Z6 e9 j
ns_marquee=document.ns_marquee.document.ns_marquee2& Z0 \9 {9 Z7 @: f9 M0 E
ns_marquee.left=marqueewidth+8
; |' K4 j# [& P$ c/ ons_marquee.document.write(marqueecontent)
* N6 t7 J1 ^- ^" {ns_marquee.document.close()9 b8 x$ A! N$ g$ @0 ~- `
actualwidth=ns_marquee.document.width
/ l {8 ?1 ~. P8 N}! Y9 q1 i! \: ~. p: y4 n& B( J
lefttime=setInterval("scrollmarquee()",20)2 `, z& U# r# [( m3 |9 Q5 `
}" }' D! H* _* T6 d0 [8 o
window.onload=populate
) r$ r! E4 r) y9 i) e5 B2 ]8 }( a* B) K% z o
function scrollmarquee(){
5 c; [9 l% Q# n8 A/ Qif (iedom){/ w2 Z' @2 T: ]# @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 u# @! o7 }& [" j7 y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 a4 e0 T$ i% s/ H
else
, G6 Q, W2 g. dcross_marquee.style.left=marqueewidth+8
) d o% Q0 n6 c4 o9 `! @1 x+ Z8 [6 {5 j2 Y! b$ U6 F, v
}$ c* z- B5 `2 q: o$ P
else if (document.layers){
( V- D2 S: C! ?& L' S# c' D- Kif (ns_marquee.left>(actualwidth*(-1)+8))
1 s6 t( e7 f, ^1 P! J/ a2 ?ns_marquee.left-=copyspeed! U4 E' S: |* d& ~
else
- \/ U9 e- m' L2 uns_marquee.left=marqueewidth+8- n1 t5 N8 m! ^; m: r( N# F
}2 V' B7 A9 ]+ \7 D+ K
}
+ ~8 Z% ?% o! g% l. R& T3 d6 j w9 L# \$ o& a0 k% `% D
if (iedom||document.layers){
0 k' f0 n; l8 b( P2 x1 N2 wwith (document){
7 b% g, E- q9 i; y7 ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% `" a; O: D( b7 z( A
if (iedom){
( q3 n% W; s/ e$ J, T$ j0 Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& E" C$ k+ @, u$ W- [8 Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& m" \7 a: n8 ` f' ?: x3 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 F1 x9 x2 @" R8 s
write('</div>')! l1 i8 j) B3 t0 v% q" M0 d
}
# G: J2 j4 E; selse if (document.layers){
* ]6 B4 \( `: q" Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& z8 ?4 j6 @1 W* P% c- Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 r G3 c& H; a" V/ Y" c
write('</ilayer>') t" `. ]& o$ D0 \) r3 p* n
}
% K+ ?; L# C) q8 x* \/ k5 U! Ydocument.write('</td></table>')
( E. v; ~) O/ u}
+ f* U0 _% A8 V& f+ x! H6 d}. l& U7 l: I4 j5 S2 k
</script> |
|