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

|
网页之跑马灯文字特效
//修改宽度# K7 ~# |7 h, D4 t
var marqueewidth=300; X" N$ q* f6 w0 e+ f( L
//高度8 A( M3 ]: ~9 t( P! [
var marqueeheight=25+ @+ B0 b+ _$ s% s5 ?% ^9 F. e
//速度(1-10): O7 f7 `9 q1 m0 Q, V
var marqueespeed=3# y" X3 {. |* D8 l8 z
//背景颜色
1 V+ E0 S3 }$ ?' G' w/ }var marqueebgcolor="#FFFFFF"' S# T& x' X& @ T
//是否能暂停 (0=no. 1=yes)?& o8 ]7 Q' X2 [& \
var pauseit=1# L" R( \ P" h9 Z
, t% c5 E) `" {: b; k& y//修改显示内容: r9 X- v1 D' }8 x/ L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( {& W z; V, C0 a; q$ U* m& @* `# _5 `& s4 K* Y
1 s, W# u! R w( T% l; L
////下面不需改变////////////% _) |6 h, R9 B% {
1 w- a% [. W6 b/ c. ivar copyspeed=marqueespeed, J: M9 N0 R4 \. Z: }7 k, U/ B
var pausespeed=(pauseit==0)? copyspeed: 02 P, [- ]% P" m! r3 y; Y4 {$ \
var iedom=document.all||document.getElementById0 N0 N1 Q3 D& a: X
if (iedom)* {5 L3 b- }2 o$ G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: r4 p# u$ W5 J+ mvar actualwidth=''
: L+ ^( {9 x& g/ y& nvar cross_marquee, ns_marquee
# X& h- q( P. Z1 R( Y6 o: ^
: ^# G* p- c1 q6 t, y( z% ^function populate(){ e# i- q% q' p ^& t, R
if (iedom){+ U+ z" J _8 @8 H' b5 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) n% d% J1 }( t5 ?" b
cross_marquee.style.left=marqueewidth+8
! c1 r0 a' W) A( z+ J/ } lcross_marquee.innerHTML=marqueecontent0 O" s" ~ N5 V0 }* F8 Z V5 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- E7 K8 S3 k( o2 R! h, K2 o# B
}
" n \- w& j( Aelse if (document.layers){7 G' `- d4 o. @3 i
ns_marquee=document.ns_marquee.document.ns_marquee22 C4 _! T4 Z% n8 v8 s' Z$ V
ns_marquee.left=marqueewidth+8+ T; Q) \ Z2 }% I6 _" t
ns_marquee.document.write(marqueecontent)
$ v% S) W5 L' l3 N* rns_marquee.document.close()
% W7 Q4 h7 x3 Q+ [* _actualwidth=ns_marquee.document.width
2 f2 s, N* \8 ?, [- H}" N3 a$ F( u- I) H
lefttime=setInterval("scrollmarquee()",20)) P6 B5 B3 @2 l+ ^+ k
}
4 {- K* }/ D5 M$ Z& }window.onload=populate
1 }5 h9 w4 w: {4 Q* w. d! S# ]* }' X6 k( b' g R% M* S! T
function scrollmarquee(){
- y- k. l* j* m* C- r+ G# Q6 vif (iedom){1 R( ?% i( L! s& L! f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 K3 ]7 }: ]) Z9 W5 v7 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 M6 V1 T* U4 ^. S5 K0 n9 S/ i
else; T% g" M1 p7 s& `& t
cross_marquee.style.left=marqueewidth+84 f7 T2 u( w0 V) O# m
2 z+ q) c: D0 U8 @
}9 L8 P/ c- L# k: R; y
else if (document.layers){% l6 |; u3 R* ?7 G$ c$ A" `
if (ns_marquee.left>(actualwidth*(-1)+8)); X4 \5 s! N7 c% g% j8 ~
ns_marquee.left-=copyspeed9 n" o1 X: g9 \ K2 a. \
else$ i5 G6 Q1 Q" d5 M6 ]0 ~5 q
ns_marquee.left=marqueewidth+8% d q/ P7 m! \ d, p, A4 z' h
}
1 f! T% h2 F/ v( g! P6 |' X9 |- }( Q1 K}
) n8 R$ |4 o- `# H! v8 I6 f7 U4 j8 X3 x8 G/ D
if (iedom||document.layers){
' J" _( a' G) x+ X# wwith (document){1 K! D/ c/ M3 N) V$ D2 O, g
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( `; A2 u1 Y/ S* B( Mif (iedom){
( e' h& C3 `6 u: x! X+ F6 a2 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! j+ Z+ A- q. t* Y, I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 h7 A+ l+ ?7 T( ]( |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% q' q4 `( p% V& M3 y, W
write('</div>')3 Z6 V" w2 x( P, s$ v# c
}6 G! T- H# p+ F2 I% t
else if (document.layers){
/ r7 M4 q8 S$ V' ]. o- Swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( V0 v6 \" S0 k6 @& i6 J) a% I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 {; ], O& @. S& x6 e0 U* a
write('</ilayer>')+ u. `# t9 N; e* m4 X
}
) e3 h2 g) i& I- g$ Y, l2 xdocument.write('</td></table>'), ~# V/ D3 z1 }' R
}
, y p& s, h+ z# B9 D}( A; v$ i# C8 r6 H; f. x
</script> |
|