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

|
网页之跑马灯文字特效
//修改宽度4 q& @) A% ]- y* t+ D' o& V' F
var marqueewidth=300
% b3 A2 N+ c* x! D//高度
5 H' `; W! Z) S' Q7 F0 pvar marqueeheight=25
2 p1 n, _# [$ h//速度(1-10)" J0 F0 H, ^1 \! Z# U6 ?
var marqueespeed=35 W2 m$ M6 G( a
//背景颜色2 ^) {" b3 O4 X
var marqueebgcolor="#FFFFFF"
3 K6 Q# A! {; Q' |; J0 g( w//是否能暂停 (0=no. 1=yes)?
" p' S% v" o$ {' A+ X: tvar pauseit=19 k) L& v) O% Q# D, [8 t
/ B+ z8 b& ^5 v" L//修改显示内容 \( P2 u4 s7 H* X7 O7 z9 _
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ H/ Y e9 a$ m' U: O& r2 D. s; J) t* ?* p$ ?4 d
" a1 Q* V+ @$ k/ l" U% t8 m) n+ k////下面不需改变////////////
! ]9 |9 x3 ]* O. e6 c% P% W* }; c% c3 C7 h/ o$ w; J1 f8 p& O
var copyspeed=marqueespeed! U& T j; @" A; U7 E% q
var pausespeed=(pauseit==0)? copyspeed: 0, @5 U6 q( ]6 |0 k
var iedom=document.all||document.getElementById
( w3 U) |- x5 ?& @/ P+ {. Kif (iedom)
) V8 p/ E( H( cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 _- a' n# q4 S3 V% ~0 Uvar actualwidth=''/ f* M: ]0 y) @4 T( b8 X; e
var cross_marquee, ns_marquee% ~3 v) D' F7 d1 q1 l0 U' Z. f
# q1 E$ C: f( Z8 M
function populate(){
( c9 [- h9 y/ Qif (iedom){# p9 u7 b% l8 L+ w1 N1 e$ G# ?2 N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 c# q& U, u% P; `+ {" s/ M
cross_marquee.style.left=marqueewidth+8 @+ z% b r) e4 l- }
cross_marquee.innerHTML=marqueecontent7 V7 N$ [$ ~" `4 i4 B9 b: c. r) M! R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: y. ]& J: D. L3 ~1 ]! u}
$ r# p' {+ r5 l/ ]else if (document.layers){
, K# z3 _; h" Z4 ^& S+ X$ M/ Dns_marquee=document.ns_marquee.document.ns_marquee2
, u( C/ x" B, O0 a: l" C6 W3 Tns_marquee.left=marqueewidth+8
7 a- H$ p2 d+ k) D3 ]1 h: @ }, bns_marquee.document.write(marqueecontent)5 U/ n0 T- y2 o
ns_marquee.document.close()
* [0 y4 {0 r# I& s4 aactualwidth=ns_marquee.document.width
- q( h9 L8 U' D2 n4 U' i7 P}
+ C6 m6 M9 L6 F. P9 q q- Xlefttime=setInterval("scrollmarquee()",20) k P5 K/ y/ ^$ \. E) K" A( e
}* _6 X% m B: s$ @" t$ J
window.onload=populate
* _4 |/ k: p3 h! K9 h, H9 i; t" r0 H: K" t& B7 f3 v
function scrollmarquee(){
# h% H+ Q4 Q5 J s tif (iedom){( O; |7 a8 q( F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 V+ u3 V4 W! {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 ?9 z2 m% w; p! v5 telse8 d8 ^5 h3 R! p
cross_marquee.style.left=marqueewidth+8! n. p& Q3 u* l. R! y
/ {$ v* F; c; Q) i
}; e. Q# Q, ^5 w( j& }3 C, d" ]) o
else if (document.layers){6 h2 y# U# S4 V \
if (ns_marquee.left>(actualwidth*(-1)+8))
; R. M4 h8 N" C. i; E. Pns_marquee.left-=copyspeed; v/ \! H, ] Q/ Q n/ j$ F
else1 M4 q$ H0 D9 p0 A! v6 K( L) y! H( c
ns_marquee.left=marqueewidth+89 s1 _0 b' e' c9 E' o2 z/ ~
}
3 z) {$ G- W0 R& Z" x}! T! K( W: x: w+ N4 W
4 K- K8 n, ?: ~0 g
if (iedom||document.layers){" ^" w% X$ e) o1 i% n0 [! D7 g
with (document){" M1 k) p) J p8 B/ U+ [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 P) K7 s0 T8 U. g* ?
if (iedom){- c4 Z1 l( a* d( N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 r1 f" w6 c0 y1 U7 ]5 `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); a' V9 T( U& ]" ]% g" u3 f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! {0 [9 I4 z5 \( H% G7 w6 M4 j" P. r$ H
write('</div>')
' Z. Z6 h" q" c, ~4 i0 J. ?1 w, y3 |}) e* I9 {" a6 A
else if (document.layers){
* S" N3 e: }/ a, s" {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 v3 b* G. `% K- awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 T% P: U1 r9 m% Z& B
write('</ilayer>')% A) S* V1 s! q1 u- I! \
}
2 ?& e6 p( r8 Q6 Edocument.write('</td></table>')
3 s% Q7 D* H6 B- r2 Q}
1 N! T+ {8 b( ^( [0 x! k}6 k; M6 w- Q! T e+ d* q
</script> |
|