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

|
网页之跑马灯文字特效
//修改宽度
5 c# M: c1 h# y# @" i& ?var marqueewidth=300
* X9 ?* Z7 y! h) L//高度
8 Q7 b: N V. i. wvar marqueeheight=25
& R5 G' Q- C E; H//速度(1-10)4 a+ L9 T. f$ [+ S- ^: j5 ]
var marqueespeed=3
( u. s3 r# a" `7 E4 Q! O//背景颜色
( B" m+ w2 A R6 X8 ~, Uvar marqueebgcolor="#FFFFFF" g q$ V G0 }, _) t
//是否能暂停 (0=no. 1=yes)?3 U; @4 a0 k7 u$ _, ]! w
var pauseit=1: J8 x$ f; `$ m. o2 M( u7 j- b! [ H
) z: p1 v, B! Q* G7 A
//修改显示内容
% H; Q& ~) r( ]6 I, ~+ `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; }/ w; o) x, S% V( F
3 |1 n! O7 k+ H
$ B9 b9 L& L5 {////下面不需改变////////////3 {) u5 [4 g8 n* r
- }* P- T5 |0 p" n% e
var copyspeed=marqueespeed
( d7 C) _* M. n, m6 Z: Bvar pausespeed=(pauseit==0)? copyspeed: 08 Q9 o ]5 d9 J5 W
var iedom=document.all||document.getElementById
: g+ e {" C- p& G( hif (iedom) [0 Y1 Q' @! O/ ^" H. m0 l! D4 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 F, w# k+ b* w8 e* F, h
var actualwidth=''2 {" b' N; m W3 E* B+ |
var cross_marquee, ns_marquee, q/ R7 o' Y+ r( \
/ m+ [- n! {, F& p' D% }' lfunction populate(){
4 o% I' {8 t9 w5 ~* Nif (iedom){" l, R7 t4 d# w
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee S$ P3 E4 s& t( _: {! Z+ [) |
cross_marquee.style.left=marqueewidth+88 q% o# p* [# K8 h5 p
cross_marquee.innerHTML=marqueecontent4 V4 ^( q6 M& I7 F' d% d+ ~. W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% Q" b! `0 I4 N! h$ q: Z9 b9 l}# R# @: d& B" g, J
else if (document.layers){
, t& ~) L* @+ i# Hns_marquee=document.ns_marquee.document.ns_marquee2
2 u- A) _5 \/ n6 P) T1 ~3 j5 l$ S2 Q, ons_marquee.left=marqueewidth+8+ Z3 W7 b) r: e$ K0 W# i
ns_marquee.document.write(marqueecontent)
; g7 u. J7 o4 G! ~ ?- m: Ens_marquee.document.close()
& R3 r) D1 |5 x8 yactualwidth=ns_marquee.document.width# \5 U* z- A+ K* ^, L
}. G; R' b% g4 O$ d
lefttime=setInterval("scrollmarquee()",20)
6 V) a7 q* Q0 ?$ Q7 C}" j% n% h# V$ T- o' T' M7 [
window.onload=populate' k. P! F+ O1 J1 w1 a1 r
w6 u! t0 e! a) M! `( K) `function scrollmarquee(){
5 o3 ^) |& a" J& s2 t- V' I4 uif (iedom){
: W6 K3 S! s/ H9 d9 p1 V) Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! F, j0 i) n0 i9 {* ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* N* V5 a' H/ S$ e
else
. A- A4 H# P; ?( p; ]9 x3 K# Kcross_marquee.style.left=marqueewidth+8
1 _; T5 i7 [! L" u& x* D5 g/ Q
}
* O( q) }- @2 Belse if (document.layers){4 c1 B7 R5 g k$ H+ g/ s
if (ns_marquee.left>(actualwidth*(-1)+8))
e$ H! g+ K' M4 C' T+ Z# m' kns_marquee.left-=copyspeed+ h) G( a4 |1 P# |6 E; {: _4 E
else
# C) c n7 M' Mns_marquee.left=marqueewidth+85 d$ t" F" O. w5 B
}
/ j9 e: E* m& \5 \}
" C5 e' m" x0 M6 X Y) y/ u9 @$ Q) x, y
if (iedom||document.layers){
8 n( a4 ]( Y. j' M/ Q1 \with (document){
4 H5 J/ b1 R; i( C- }" ~# sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( v$ G: e7 n% p: B$ Z
if (iedom){5 [; l- m. H$ q- p9 ~4 B7 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 K8 q4 y8 y( L6 c" {4 R5 l! E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 m/ y5 D" o0 ~; ^# x/ U& V3 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 N( N, }& ]8 h+ A1 W- l
write('</div>')' S1 M3 P5 G4 {8 N9 b
}9 j S: I! ~6 r' ^4 Z7 s
else if (document.layers){
* b$ N( Y% m4 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 ^6 j4 \% o, L, f& W- N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ u( D$ W( Y, e4 K1 G" J4 ^+ ?
write('</ilayer>')
. y& z2 ?. L2 d6 I# t}
) b: c, ^2 H* _" V3 tdocument.write('</td></table>')
I5 \" `7 h, A5 j) `}$ I8 x) f) H. _! f( j
}
8 ~) I; X! e. g0 F* L, a. t: w8 l</script> |
|