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

|
网页之跑马灯文字特效
//修改宽度
- h' K X& l0 h, l. L0 h5 Zvar marqueewidth=300
8 c- ?* e1 W1 n/ @+ m l//高度
3 ?1 P4 i s' b. w; Hvar marqueeheight=25
5 R8 x, b0 {. a' c4 z! @/ L//速度(1-10)9 O1 w1 Z1 Q. l( |5 y
var marqueespeed=3 l8 [2 t i$ e+ F8 a, v
//背景颜色0 @4 U5 h! S# v& N
var marqueebgcolor="#FFFFFF"! Z2 ?6 f2 M4 S: G) m* d8 T
//是否能暂停 (0=no. 1=yes)?
) q& ^: f6 P8 B* r2 g4 O9 I: Avar pauseit=1
5 {6 u1 q& t ~. K4 C! O5 J4 t; R6 R6 C, W \
//修改显示内容
( S& U7 q% z) G( N! I3 B: ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" _$ O/ Q& N: p8 G1 \: Z
+ \5 Y. `' ^4 W. G& p& y
) S3 h; d8 J: {; L. d////下面不需改变//////////// N( C& p* d4 w
3 Q4 M& y( \3 k, @; V
var copyspeed=marqueespeed
$ F& E) U, G2 B5 K1 hvar pausespeed=(pauseit==0)? copyspeed: 0
+ N6 A/ W+ ~2 W0 v6 d) @var iedom=document.all||document.getElementById
: y! ^2 J3 [: Bif (iedom)0 J! q% p& T% P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 C5 ?4 {& s1 J8 ^var actualwidth=''" D7 w& [0 E! j6 ^1 J: u+ K
var cross_marquee, ns_marquee e: U5 _' }% i5 j
. |* J3 \$ D$ x) ?9 P6 o1 {
function populate(){ f+ `1 }2 ]" S* [/ t0 d/ o9 @8 F
if (iedom){( Z3 f* t+ U4 |- G
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: x0 ~3 V v( a$ Hcross_marquee.style.left=marqueewidth+8
2 ^3 l( c- I! {: Zcross_marquee.innerHTML=marqueecontent+ L% t) Z) S+ E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 A- ]/ t- ` D9 l5 Y( ~4 g: }5 s' @
}: U t/ [% X( {
else if (document.layers){7 ~2 Z x! e. g2 h3 p
ns_marquee=document.ns_marquee.document.ns_marquee2* u7 i1 i% T/ Y I* q1 F7 K
ns_marquee.left=marqueewidth+8
; S% h& T, a' ?. k7 o* J- b6 l% Tns_marquee.document.write(marqueecontent)4 h( D _2 P6 X& j
ns_marquee.document.close()( E {: W1 p V$ G* h0 t8 E& q
actualwidth=ns_marquee.document.width
$ j$ e, T: W% Y1 Z) |' A v}
, a5 |) P, U+ E6 Wlefttime=setInterval("scrollmarquee()",20)% W$ d6 k7 E" U1 z7 K! c
}: G' W/ H- ]4 O& _9 K0 I
window.onload=populate
8 m3 q( i/ A7 s2 t, z1 X R" ^/ K6 ?4 F2 J; {: U" u/ n
function scrollmarquee(){
7 l. t4 q) T1 @/ g- k4 E( r' Fif (iedom){
% d1 L' V) n, k# R& x! i2 y$ vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" \1 j3 u, D9 j, `3 q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* ]9 ?; k5 A0 F+ O2 p% z" z3 B; N' L- Jelse
* t4 k+ v4 ]8 A& Ecross_marquee.style.left=marqueewidth+8* O0 O: G$ Y( y# _
* L$ @+ t: p% d+ _' a/ r/ j8 ^ ]}$ W# m, R2 K: x. p6 j: b% D
else if (document.layers){" p: v1 ^$ ?6 k
if (ns_marquee.left>(actualwidth*(-1)+8))6 k( i6 \ x' m* C. x
ns_marquee.left-=copyspeed( E, G. g! ?, F9 M
else
7 r, T9 R! \! L3 m! t+ @9 mns_marquee.left=marqueewidth+8
+ w& Z9 O7 ]% v. ^* S0 U}
5 {* h5 R0 ]3 l: G3 V}* m) |1 F! {+ L b1 {' e$ ^
! O+ O( d3 {) R2 {6 j, \if (iedom||document.layers){% d+ z, ] R( u) A0 i7 L
with (document){0 y! J2 H) t6 m7 k9 L$ z9 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 @) e' Z! P7 H" j' ~
if (iedom){
* t4 a& r7 m. B# b6 ^- Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" t; b# V6 L! d" dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) k1 i0 X: f+ Q9 Q0 r3 y( t% |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! f" S- Q. u! D( X9 Z
write('</div>')! g8 E/ E: \% s' |* K4 [: _7 \
}+ @9 y( V. T* t1 y" {( W
else if (document.layers){
. @, V0 q, X& D P" A# mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 r9 R/ k6 X6 I: X1 E* hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 z( U) T& f! W T" d
write('</ilayer>')$ b. q& p9 g/ c" r, F0 Z. [( z
}
0 f( c3 ~0 P- V. \) Pdocument.write('</td></table>') {7 f+ s' s+ G! |) k
}$ \7 u! ^0 V% x1 }1 N3 W3 r
}* O. z# e9 R! t' s/ y% f8 b; R6 k
</script> |
|