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

|
网页之跑马灯文字特效
//修改宽度$ I# ?( [7 Q& F4 V1 O% I
var marqueewidth=300- z$ p: b- X. k: r, q) P
//高度
0 n: ]( l, w S% D# I5 Y) _/ }+ B5 Mvar marqueeheight=25 b. \6 R. \2 W1 V: X
//速度(1-10)0 D9 l3 T( C* O0 ]4 c
var marqueespeed=3+ {5 |2 g* ?6 |3 m* n; x: `
//背景颜色
( p! X$ [. i- v0 N: U: @4 Dvar marqueebgcolor="#FFFFFF"* \ Z% H1 |2 }4 ?' X
//是否能暂停 (0=no. 1=yes)?+ S$ E Q' i3 Z1 {+ u* Y9 ]1 L
var pauseit=1' l* b e9 p! [/ ?& O t
0 I" g& e# `. O2 p( }
//修改显示内容! ~' w0 K7 G/ l* p" g2 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! t! W* T- B1 K
% t( `0 }6 P4 l5 F7 K: M) J0 B7 ]2 f6 q. q# \
////下面不需改变////////////
B' y+ g; [5 U6 U. I* Q, ^& c: M7 _7 n6 ^
var copyspeed=marqueespeed
9 F5 W" U M2 t0 u0 q% u3 L6 tvar pausespeed=(pauseit==0)? copyspeed: 0! U3 a& L9 b7 c; j/ Q6 x3 y
var iedom=document.all||document.getElementById9 u4 S3 k5 `( k# |3 h
if (iedom)7 [/ n. q$ m# Q1 u$ V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') M9 G& c6 L3 A" W8 s; ^( l
var actualwidth=''" b0 M) Z! A# T6 g! m2 W
var cross_marquee, ns_marquee& q! o( D: J* J1 p& f4 p% n2 z
. k% D& O. f. ^+ vfunction populate(){: @5 ^# [6 k7 F6 e' K9 w$ T
if (iedom){6 R* C2 m/ o. `. o+ @2 N
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, J2 T1 q8 U1 O3 X" e& q2 Ocross_marquee.style.left=marqueewidth+8$ [* C) d' V4 ]5 } c
cross_marquee.innerHTML=marqueecontent
- i4 Z; D6 a, K- D& d! I: B) D! gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" y9 R0 w: Z3 g# N) O; {}
( V- e+ E4 }$ P& [* celse if (document.layers){
^! H/ D/ j1 P# j, g9 m1 {ns_marquee=document.ns_marquee.document.ns_marquee2# }/ M2 I* {: B( [! H9 J0 e) W& l
ns_marquee.left=marqueewidth+80 }# l* X( M% f: {/ W* i. f; Y
ns_marquee.document.write(marqueecontent), A5 M1 w0 I1 @! W8 t% B
ns_marquee.document.close()' _4 T& h9 K- g4 B/ x
actualwidth=ns_marquee.document.width, t6 E# A4 k$ _, e1 ^0 l: v+ }
}
3 |! [/ Q) e5 ~/ d4 k# E% Slefttime=setInterval("scrollmarquee()",20)
* v: t; D- g1 Q7 a2 k: |2 q) Z0 Q& i}
. m5 t4 S. V. [8 Ywindow.onload=populate( [/ F6 ?6 o* q9 x- @2 r
0 K( a* _) w# |5 V7 s; |) d8 Tfunction scrollmarquee(){
+ W& W0 k& j0 m# xif (iedom){" S% S. `- z1 \& N: ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); }) l( O# q) ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ c+ X* _1 P+ X) p! ?. A# W! F8 n. Ielse
1 B- J! F) u/ N) N9 z( wcross_marquee.style.left=marqueewidth+8
, @2 B% M$ Z" c- n0 a) O
" q0 A& ^ S9 J& O0 ~% K}
( U& b2 h# b7 d' r. {( Z' ?else if (document.layers){
8 m* a' k! F+ S i# D7 ]/ Bif (ns_marquee.left>(actualwidth*(-1)+8)) S3 ^- i* B, I6 ^3 w) q) a% |/ ]
ns_marquee.left-=copyspeed* h. I% `$ Q( Q
else2 u( T2 G1 H) q/ S8 Q% k5 ^: [* Q% }6 p
ns_marquee.left=marqueewidth+8) I6 {) d5 d r+ T' @3 j: M. M/ W
}
6 ~# Q) J% t# ^9 e}$ `- _5 b0 D& b9 @4 R
- U1 C/ A. N# `1 x3 j, A; V
if (iedom||document.layers){
- Y, W) g9 C5 z1 t4 Pwith (document){: V: I3 B* c$ ]/ q- M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' s" }8 t$ A( K: o; M: X: T
if (iedom){
4 z" d0 ~, Q7 u" N( `) r3 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 J* o2 t5 G& S+ Z owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 [/ V* p, Q. U0 g i# a5 O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& o$ P; N# n3 m# J
write('</div>')* ~# f" n- U* f' y6 E
}) n& E+ K& J a( ~
else if (document.layers){( p- ]7 r L7 x$ T% @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( e+ [8 G. w. p$ v/ H; _
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) N+ {' ?* o$ P7 h$ V/ bwrite('</ilayer>')
; n3 ?1 l" V' Z4 N- h}
. E) k' g9 n9 f8 T& Gdocument.write('</td></table>')0 }/ Q" U6 |( H( B% z
}
, M* Z/ R B9 F' f3 c}
$ w- Y/ I7 H) Z# ^* u) e</script> |
|