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

|
网页之跑马灯文字特效
//修改宽度
- x' P! [4 T0 Pvar marqueewidth=300& |2 d: n. h' J5 N
//高度
. h2 q. V) ?- f$ Z5 g. ]3 C! rvar marqueeheight=25
* ~' Y& k( P# t& K//速度(1-10)0 A$ @& r& c& M7 }1 T, z
var marqueespeed=3. N1 E- x* V- E D( _ I+ t$ T) J
//背景颜色
) d( V, X8 ?, f hvar marqueebgcolor="#FFFFFF"
0 p9 I% y/ M# f p! |/ v( k! B" R//是否能暂停 (0=no. 1=yes)?
0 T# e( j) j. I% T: S) s! xvar pauseit=1
# u t+ t* ?3 f% x+ ^0 s
L/ Q! X/ a X' L' G; z. U//修改显示内容
8 v4 q6 F) h. j0 d3 s( W3 ]. nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 Y" [# F+ }3 C) Y
/ x0 r( n. A3 l2 J6 Z4 q: W W% p! k! G# o& O; K5 n- h! p
////下面不需改变////////////) j7 e! Z6 h4 O0 i' m. B
1 Q' S5 X6 g. A5 g3 rvar copyspeed=marqueespeed! s! O5 f. \2 u* z$ k2 |0 T
var pausespeed=(pauseit==0)? copyspeed: 0
& o% c* L( E7 W: S3 k$ [! y8 yvar iedom=document.all||document.getElementById; R, R S5 q9 o0 O) L
if (iedom)
6 R) T/ I" _7 Z: Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ H( Z6 ?6 {' I4 G4 |& k8 ivar actualwidth=''' G! ]' p( S/ E3 ? E$ q0 ?; o
var cross_marquee, ns_marquee2 w+ a* p# f8 v- g% p0 Q: |
5 |8 W3 h+ ~; V% ~' \' o
function populate(){
, s) M) w6 a3 {. X& u8 r8 Bif (iedom){
7 {4 q$ a+ n- {! m% H/ y% _, Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' b" t v1 l3 _4 xcross_marquee.style.left=marqueewidth+86 M/ e4 P9 v5 r4 Z g# |) a P& r6 t
cross_marquee.innerHTML=marqueecontent
' w( K. M3 z% `& ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( t8 {. C4 u# Q6 `5 o4 t- H$ |" D
}; ?% v; M9 N' I% ^9 c* J
else if (document.layers){
* B& f% i% I3 u" J- m" hns_marquee=document.ns_marquee.document.ns_marquee2" |2 e" e% f8 }" Q% p
ns_marquee.left=marqueewidth+89 X6 i+ P1 e+ x) ], k: a
ns_marquee.document.write(marqueecontent)) Y: A4 W. O6 I, @0 Y1 S* s9 U8 k% F1 Q
ns_marquee.document.close()
3 R& ?/ y) p' J- x1 gactualwidth=ns_marquee.document.width; S' o1 @9 f. C: G/ [: i# h, o
}0 ?+ g \: Q4 X, g( `
lefttime=setInterval("scrollmarquee()",20)
+ X. o4 k6 F0 Z}5 ?0 I- W8 A& `% t) x% o0 d3 \
window.onload=populate
, @/ O6 m; `- v9 K; ^# A$ l# R* ~( l* V
function scrollmarquee(){
$ ^: x" O$ ]# \2 n" W: k" Uif (iedom){; c+ v$ j+ h; Y: l: `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 L# }& q/ U2 t7 D1 |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. x& _$ }$ L: H5 W9 B( [
else
- m6 r. G& G" J. p' y9 fcross_marquee.style.left=marqueewidth+8- v2 R' ]2 @4 S5 U+ o! O
- K1 E" Z# h6 n* h! v+ U7 @) l3 ?: z
}
' o: m5 e3 x- P$ x% ?else if (document.layers){
$ }, c% p; U( A! {. ]4 a! t: Fif (ns_marquee.left>(actualwidth*(-1)+8))
5 Z' ^; H6 c/ a: ] w2 zns_marquee.left-=copyspeed
% Y9 c( b8 n" V8 h# |else/ C$ U; p1 f, [, }+ q J
ns_marquee.left=marqueewidth+8. C- T w0 ~, u# B. E" M
}
# V+ K$ B7 d( B# {3 B1 E}9 T8 Y2 i& I# b' M& N \7 B4 e" Y8 b
1 |4 H3 f# h8 i! ?8 ]
if (iedom||document.layers){
- X" _. c( ^! c6 m X( K* uwith (document){( k3 v8 z' d9 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- W- _5 v! @, b5 q
if (iedom){
- g$ {% S: X+ kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ @. _2 q, M! [9 C8 N, e# j: F4 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 E/ N% h/ B& w5 S% G- ?' wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 Y, g3 V( b, q6 k f) Q! Twrite('</div>')
# Q; Z+ K b) K' U/ z}
7 v) m5 c5 V5 A5 L Z' |! b7 ]else if (document.layers){
; O8 V# s' l. i$ C% J/ Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& p) j8 [2 |5 l* Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* I' }! Y8 I; @4 o: l6 Z0 S) qwrite('</ilayer>')3 R( h2 b* y% l6 B
}9 p& _" y+ q$ k' ?4 ~! g- w
document.write('</td></table>')( E$ T4 a( x) A j3 b
}
; ~+ R \3 A8 d. u2 t% @4 v}+ r ?8 c7 U( Z! H$ ]2 Q' D# k' b
</script> |
|