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

|
网页之跑马灯文字特效
//修改宽度3 g7 b3 ?* d/ {# ]: b
var marqueewidth=3003 S. h+ L& {0 c |8 m0 m% S+ l/ Y2 f
//高度
/ g7 }+ a- x' _* Avar marqueeheight=25
: B9 v# o4 I& _7 S1 h: ?9 ~//速度(1-10)
. f/ K0 F& m. P! Lvar marqueespeed=3# x% `: t1 b) w3 Y" }+ q
//背景颜色
) I& W4 I" ^: E3 q; A A: |var marqueebgcolor="#FFFFFF"
- o: [7 M( F, K1 ^% |//是否能暂停 (0=no. 1=yes)?
+ c1 p3 g E- J1 ^. [# svar pauseit=1" B% {; F/ }5 ?0 N" N3 | I; ]. f
) o# C! W; J) o/ q' q6 y//修改显示内容$ }0 Z, A; w- z. ^) D( R9 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') _, I U. N3 z7 G
% y' r, \- @0 R0 k* i* k
( m, r* X! F+ U- t& z
////下面不需改变////////////4 x! L/ C6 o9 l; `
. q g$ i% M6 B6 k( }0 R% K
var copyspeed=marqueespeed
. K# s8 J/ {8 {. ^" ^ G* ~4 }2 Nvar pausespeed=(pauseit==0)? copyspeed: 0
" l0 r3 r) R! K: u. D$ M" [/ fvar iedom=document.all||document.getElementById! U: K7 g- S! U7 S9 z2 @$ R
if (iedom)0 g/ ^9 ~2 A1 T, B) x3 ~- F6 i3 a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')) K8 W, z! `, l# g& t
var actualwidth=''
! t. p1 d+ Q' i: Pvar cross_marquee, ns_marquee
7 W! g) |! x& W# [3 ^) ]) i8 n0 i2 }: v/ g. v) `
function populate(){$ l M6 X" g% W* b
if (iedom){$ C; m+ B1 E# m' {" j" @+ z6 a# T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" N( Z( I5 U& n: lcross_marquee.style.left=marqueewidth+8
* N: O/ a" ~' d6 A5 ^1 V( ycross_marquee.innerHTML=marqueecontent
7 c% ]/ z! }1 M+ u* aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 u5 a1 s% O ^! {3 t! k3 G
}
9 U: y# T. b' i& }3 ~. @else if (document.layers){
" D) ^. [! y0 O/ L& M) i; S+ D" r0 Cns_marquee=document.ns_marquee.document.ns_marquee2
! b' ]& x9 q$ g$ {5 Sns_marquee.left=marqueewidth+8% ~# v& U5 y$ x' o; i8 w& C' Q' i
ns_marquee.document.write(marqueecontent)
7 p% N1 }$ U$ f yns_marquee.document.close()4 t4 U0 H; k' z9 J: B) ]
actualwidth=ns_marquee.document.width" W+ I! `$ k; }% W4 {9 w8 Y
}
4 l2 S; v8 J9 h) Y5 f' f+ I* a, Plefttime=setInterval("scrollmarquee()",20)
8 Z6 @/ Q" q; d2 @0 [: w& I}" {9 V; f- [/ G. q& R! p, W
window.onload=populate
! E D3 j# ?; u
# E1 L2 z: h pfunction scrollmarquee(){# v1 u( Y) C$ R$ {
if (iedom){
( }; G: j& H _3 u7 wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( y7 Q* p. ^% Z2 ?7 F) n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' Q0 O y2 s delse
5 h8 v* z- U3 i) n3 F* o3 Scross_marquee.style.left=marqueewidth+8
2 I* M$ O7 ]- a" m' M3 l( D6 A: e- ]/ b+ q: G2 J/ v9 K
}
\5 q+ u, Z2 h2 A/ Oelse if (document.layers){0 m, x0 F$ x, d; L' B! Q1 ^, w0 z5 |& Z
if (ns_marquee.left>(actualwidth*(-1)+8))
5 B/ V \$ S) H& l7 Wns_marquee.left-=copyspeed
T1 Z W& b$ p+ R9 C: helse
1 j: G/ n% S/ `9 u, Jns_marquee.left=marqueewidth+8
; d" R O# H% b* P9 [5 u4 U}
4 q& H0 G" t; O1 O! [* {% }6 P}, B u/ {! X- O0 Y. t5 g
' n9 V* k2 m! Q O- mif (iedom||document.layers){, [2 V/ x O3 R v; G8 F' Y
with (document){
3 i% L& L. A$ N& L# ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ~0 f9 ~5 L* ~- b6 V; C/ H
if (iedom){
/ [* C, H- C; N" Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 p$ G# t1 ~+ G4 vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# G" K" D0 q/ X9 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 o* x' d+ B' b6 _7 z$ lwrite('</div>')
7 o5 n$ O5 F c}
( \+ l. a2 ^3 n$ uelse if (document.layers){. H/ _3 D: c; {( ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 J( \! J7 v0 E- {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 S: I" v& E8 L* `6 I" d
write('</ilayer>')) c" n) k( n$ W# r. ^" d5 r' r
}
$ j+ x* r; n, R) adocument.write('</td></table>')
, `3 q( p4 A+ v! s5 n- |+ x}
2 P' W9 f0 g. } E5 g}4 S% ~; G# v5 @; M2 p
</script> |
|