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

|
网页之跑马灯文字特效
//修改宽度9 _) B7 \, c# c
var marqueewidth=300
@" u4 T! D: t0 k//高度% Q) ~$ J+ c' `9 E; i9 K2 k
var marqueeheight=25
4 v, Y) Z- ?7 Q" Y+ H% m& h//速度(1-10)
5 j/ G9 P( c. hvar marqueespeed=3
" R* t0 J# f9 J6 _0 f//背景颜色
) Q8 L& G" L( E: u, P# Rvar marqueebgcolor="#FFFFFF"
. U7 j8 J. p9 x5 v//是否能暂停 (0=no. 1=yes)?
2 e, t( e" Q, m* o2 Y+ fvar pauseit=1: ^- Z+ K7 t& |- r$ X% A9 ~
) \+ Y W, K- R d- W
//修改显示内容
8 V! u$ X- D% x1 F1 `0 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 e) ?& J }4 ]1 |) c
N' s, Z' z/ T$ Q! ` m ], C2 a$ j4 ?. z
////下面不需改变////////////
I4 g! j6 [& d+ Z& a% J) F: J
; Y0 i- y7 e# ^& p' l/ K! v/ q2 zvar copyspeed=marqueespeed& [( m& K+ o9 w5 k! p( R
var pausespeed=(pauseit==0)? copyspeed: 0) X* a. I! D% _3 p: R5 }% J z
var iedom=document.all||document.getElementById' ~# J$ ?- q4 [7 e: o
if (iedom)
) @: \, X! h# M5 I8 Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) o2 T+ O7 h9 E8 s) T) x& Z7 `var actualwidth=''
* j5 Y5 v/ W+ ?: r, }' q7 X5 \var cross_marquee, ns_marquee/ _0 X1 f' V% z q' M
0 s0 k7 \# H! H! T
function populate(){
/ `3 `( T4 A8 ]if (iedom){
0 S3 X* Q/ o; ^( r% s' tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! E7 s- N) ^2 q% f# M4 J8 @cross_marquee.style.left=marqueewidth+8: |5 R4 j. s0 ~! B# G% L6 w
cross_marquee.innerHTML=marqueecontent
& Q2 T+ ?5 B' p# x% w8 ~, ~0 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 f) n8 d/ c0 v- E( q}
; I0 s! i Z& \& kelse if (document.layers){
4 |9 A3 S0 O7 {/ c9 Jns_marquee=document.ns_marquee.document.ns_marquee2
' f& i& _( W/ F' c. J' _; P, Kns_marquee.left=marqueewidth+87 H# ?6 K4 I% K! t' ]! s
ns_marquee.document.write(marqueecontent), |) C- p- V$ ?2 o% q: @* G
ns_marquee.document.close()& ?! L/ p* A# Y$ h1 ]4 S& O
actualwidth=ns_marquee.document.width* M* z( f5 p; s+ g0 A. D9 M) k3 \6 |6 }
}/ A5 p" S8 s; F$ {+ F/ R
lefttime=setInterval("scrollmarquee()",20)
% D( G4 H. L0 I/ Y; _. S}
' m3 p' Q2 g6 C8 s% ^3 ^2 G2 |) Uwindow.onload=populate. _! a. u, t/ d" C& V
! q1 Z$ A/ t) a- w5 @8 E; e; y5 Nfunction scrollmarquee(){
' M, D9 g* N' F8 I7 Jif (iedom){1 ]; l) C7 F( i. I: A" b0 Q, |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( j7 ~2 x; C$ Z. N* H5 S$ @/ fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 z a3 G- f; Kelse
G" h; J2 ~$ kcross_marquee.style.left=marqueewidth+8
_+ r$ F3 A! H( V& Q
' P0 {8 d+ }2 W4 s. X7 C}) I G* b: k8 @" |' U
else if (document.layers){
! X$ w( G4 z3 _% b: a5 ~& Eif (ns_marquee.left>(actualwidth*(-1)+8))
& v: Y' ]7 y6 R8 L5 I) ^" [/ Qns_marquee.left-=copyspeed
% L2 s- a! m. u+ e* Welse* r" t6 _, R. [1 _
ns_marquee.left=marqueewidth+8
* M+ k# K' T, p, @}0 \& f+ g& F9 _' S& C1 Y
}
& M9 F, ]8 U2 L
1 {) B5 q" W6 Sif (iedom||document.layers){: k& ~8 u; E6 V: u9 Y# r
with (document){% S( i2 a" o7 }. S1 V, Z, V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) S2 r" D9 w& @) k7 Z1 xif (iedom){
. C. Y* [) J$ k- j9 L7 K' Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) q8 k; i) N" E1 V @4 |2 N) Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) p4 ^1 H9 E2 {& X o& y: \write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). p+ B$ t5 \! i' ~. }
write('</div>')# m1 M1 \7 I3 t4 E- P( g) k
}1 [6 m7 _& R5 H+ ?) D5 n
else if (document.layers){8 d( r. b+ X% H! @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 }- M9 w9 l6 n8 z; Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ r- w9 d+ Q- V5 }' {7 q7 @6 Twrite('</ilayer>')" A9 V( L. l$ j% G, x$ `
}
) j+ o o( P* {5 S7 k# B) ?document.write('</td></table>')
; [- T: _( w, n) {( D# a0 m}$ ]8 D. g4 h) f& E" ]
}9 E. P& ]9 w: ]: T
</script> |
|