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

|
网页之跑马灯文字特效
//修改宽度, Z$ G( a1 v$ y8 K& I; Y( D
var marqueewidth=300- n: x1 _- M' @; Z0 \
//高度
/ Y; t% J. h4 m: ~, o9 s: n7 ]4 qvar marqueeheight=259 K% m% Y' y& V- }4 C* q
//速度(1-10)
- B4 x/ d" B# b; t5 [var marqueespeed=3/ r5 \: N7 ^$ \% L) j& E
//背景颜色$ `6 L( f7 ]+ ^3 \+ f* ~6 P
var marqueebgcolor="#FFFFFF", ^5 C9 ~4 v& @/ a# O
//是否能暂停 (0=no. 1=yes)?7 ?2 m6 r& _- o( C4 j: v1 D$ x' F
var pauseit=1# A1 F. }! h' N+ E4 n4 k- R
# k8 c0 h: a3 p
//修改显示内容
: U6 |4 G4 i% c* ]. @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 J7 q3 U7 s" S8 q4 z
. T8 Q6 f E, ~
$ p* D/ z' D) e3 w) E7 [////下面不需改变////////////
7 ~0 M% Z8 P$ Z( p( P8 h4 {& q8 \5 u* h& D- k
var copyspeed=marqueespeed& v! }, @; Y- _1 _7 @6 F- W
var pausespeed=(pauseit==0)? copyspeed: 0% b. x0 O8 Q7 c
var iedom=document.all||document.getElementById. |7 U. G g. e* p
if (iedom)
" {' F2 k$ X, edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 F/ l! J3 t1 \2 q& r2 q7 Bvar actualwidth=''# a$ g! H6 A7 {
var cross_marquee, ns_marquee
0 c' }# w6 L: w5 Y- ~% h
2 L" q- @8 ~0 Tfunction populate(){
" L4 o/ o O/ E% D7 s3 [' Cif (iedom){* u6 q$ H( |4 B% Y& [1 M0 ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# e$ o/ r9 r5 i( e9 Mcross_marquee.style.left=marqueewidth+8
" R8 E! m0 L* N0 V( T8 q$ ocross_marquee.innerHTML=marqueecontent8 F% p2 k. u' h3 N; n/ H* X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 y8 T% H6 Z/ y) m" S( P}
, M1 A0 I: r7 g2 C/ }8 Aelse if (document.layers){
5 B0 r# N1 M% U; tns_marquee=document.ns_marquee.document.ns_marquee23 L8 B" X% y4 E0 ~% G' D" q0 r
ns_marquee.left=marqueewidth+8
U; {' O8 h4 i1 u+ Mns_marquee.document.write(marqueecontent)
9 l4 E! L, e& z7 s& Q d3 x0 mns_marquee.document.close()
/ N1 E: J9 a# F3 R2 J7 mactualwidth=ns_marquee.document.width) v: M: w7 f. n
}
, y% I5 K+ S# H$ O5 f o ` f4 [, Klefttime=setInterval("scrollmarquee()",20)+ ?6 d% }$ ]" A) ^. n' S5 u) F3 _
}# z) C" j Q3 L! i
window.onload=populate4 Y! _, k& v+ `
( F0 k6 _9 J. K' g& h9 mfunction scrollmarquee(){$ J; Y2 V6 g- g2 T. `: V
if (iedom){% u' U8 Q7 g, I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( g/ |/ |0 d' s1 ]% ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 l% R, K0 g( `% [ d. s. F Gelse" q6 c L: S) z
cross_marquee.style.left=marqueewidth+8
' B* r! k: P3 [# w! _) S/ ^1 v* K& M& H( r
}' r: A2 q. A" l. v% P0 S5 c, t
else if (document.layers){: c0 j7 ?7 @$ ?; |/ c: c3 v
if (ns_marquee.left>(actualwidth*(-1)+8)); h+ L% M# p/ Z. _; [
ns_marquee.left-=copyspeed7 S% G ?) ^) T
else" w. ^" A7 g. T0 }2 Y+ }5 S$ T
ns_marquee.left=marqueewidth+8
2 Z" d9 |! @: O% `2 U3 p( [* G( K}
: F* I" K, X5 K" { P- o0 E& N}
! w7 y( u% P% t: {( v- C
5 S) c1 M; a& \! M- c7 O1 uif (iedom||document.layers){
% q7 U/ v0 m6 P9 O6 _1 V) lwith (document){
9 B4 m# C8 N5 ]/ h: b! _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. D5 V9 B, a7 Kif (iedom){4 u6 w, G5 g5 Q, P& y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
L" f) ?! y( e6 \6 ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 T2 `( Q: v0 Q9 @$ h( V* l4 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 f( b# B! n' P, C* V4 m+ c3 q
write('</div>')
) w, s0 [7 D" ~) [9 C}6 \5 m# H3 K; |6 I
else if (document.layers){/ _& O+ i2 V5 k: W. O7 t5 d2 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 B! E$ D- A v, a4 E9 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 `& x# a: Y2 n# r* |& ]) x
write('</ilayer>')
* i% ?1 E; v& E( z3 D' ^* K" u}
7 ^$ M0 K9 U1 ^7 E8 H- \9 T" i3 Bdocument.write('</td></table>')4 T6 @# ^5 U2 W8 a4 D) y( H' w6 G6 W, c
}
5 Y% H0 M5 J+ J6 d}& r1 J1 s% M" ^# L) @, ?
</script> |
|