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

|
网页之跑马灯文字特效
//修改宽度
* |# N# O0 q x1 H: r% U* vvar marqueewidth=300
& ]7 d9 y w3 w' D//高度9 q; [% L+ `5 k) b$ D9 j3 u' q
var marqueeheight=25
5 S& X6 p" U/ P" E; O//速度(1-10): u3 g, U. \6 T9 e1 X: M+ v( w
var marqueespeed=3
/ k! [7 ]- C' d, W//背景颜色
- \$ E6 g3 H( @1 B$ nvar marqueebgcolor="#FFFFFF"
( d6 h% q! f! \9 m* H/ I//是否能暂停 (0=no. 1=yes)?
/ k4 Z7 u2 R1 P$ \0 dvar pauseit=1- H; n) L' C. v) q2 h( n3 v7 f
, T) B/ U0 T, y8 s9 n
//修改显示内容8 \! N$ k# K+ M K4 s, k; ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( @( r. P1 Z. W) M9 A t
7 P4 z6 x; V1 H" p7 {
3 ~* T9 L. L2 Q////下面不需改变////////////# I$ O- r0 n+ Y7 h# ^- ]$ P8 D; Y- j
! r c A P/ T& d) v7 |* y2 f! K0 Kvar copyspeed=marqueespeed
6 Z/ G! _4 I/ h6 [, Y: q h0 C, qvar pausespeed=(pauseit==0)? copyspeed: 0' N; v7 C4 L" B9 E3 a( p
var iedom=document.all||document.getElementById
/ k0 i( f$ e J: V/ U+ zif (iedom)
0 I9 Q' ~6 z- @" Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), y7 K$ ?7 f# Q& m/ y
var actualwidth=''
4 f, k. B$ a! ^* nvar cross_marquee, ns_marquee% t$ e, ^( y! `
& H4 w& C/ e4 \9 {# v! A: J. m
function populate(){
( U$ e' o. w- }. X1 |if (iedom){! D: [3 n" U h$ `: n4 \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 y: s$ s) c* v1 {$ g$ U
cross_marquee.style.left=marqueewidth+8
: S* B p4 Q6 g( ^: P; J5 dcross_marquee.innerHTML=marqueecontent
! z& B6 P; {$ b$ A& m9 }. Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. G4 M, j/ t3 A; R" h
}
1 n% M) T; ^# ?+ Z4 Oelse if (document.layers){- ~4 T) K% Z# H1 I! G+ j
ns_marquee=document.ns_marquee.document.ns_marquee2" R/ ^% T, X- l; v( e
ns_marquee.left=marqueewidth+8' h E4 _4 b, x# i& t7 L7 O0 F
ns_marquee.document.write(marqueecontent)
9 l. L* e7 M2 Mns_marquee.document.close()9 N5 w! X2 x4 {$ D( U7 z6 D2 t
actualwidth=ns_marquee.document.width' l5 K5 X8 m# H6 l
}
+ b4 _& K! W5 f% I1 j L( Qlefttime=setInterval("scrollmarquee()",20)3 N2 @3 [/ L$ s7 W( b7 @; u
}) s2 u, w# W% a! v
window.onload=populate" u5 N1 s4 N+ y; }+ f
9 E* g" d- @4 o) [) u5 J# b' `$ rfunction scrollmarquee(){
3 _$ g8 F& k" @& I& _" Jif (iedom){
6 l3 N) o" `. u) y7 R* Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% i6 {1 _$ F( g: A' d8 \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- p" w9 D" t/ ^0 }
else
. V) V% _# X8 O7 L t$ {cross_marquee.style.left=marqueewidth+8
' ]. D. ^* ^% _$ F" V( ^3 P, h A0 y
}* Q5 f5 U" M0 [ x: h9 t
else if (document.layers){
- G H+ z+ d k' e+ kif (ns_marquee.left>(actualwidth*(-1)+8))
B5 f. c" m) D B) H) U% |- ans_marquee.left-=copyspeed
6 V M; z* _3 Q( X* Q4 Felse
& i0 j& n% ?& l$ n+ r- X, r3 \ns_marquee.left=marqueewidth+8) v$ d4 q5 U4 y
}
: l, l: E3 u" p" _0 o% G# J}
5 U3 }. d. P2 s$ H& |5 J) L0 \1 |
if (iedom||document.layers){4 y6 k8 A( n" d4 K1 V
with (document){
! L* e/ t. @1 |8 Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 n, Q2 \4 d4 f) ?& D3 cif (iedom){
3 x8 @7 e6 Q8 `7 J* h1 kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 p2 `- t3 p2 W" N- v6 o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% g5 u/ B; {) L. J2 e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
# Z& ]9 v3 h( M2 c4 |write('</div>')
+ q% |8 S% x/ d! Q) [6 L7 g+ h}9 d' E h2 c. i2 A
else if (document.layers){
$ X9 n5 q! z5 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* n1 n" |: n8 V' C; T. ^3 ~& dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 I r, l2 h( \* y; l/ J
write('</ilayer>')& S8 e4 } u- _1 N1 b4 [* R
}; N, U2 f# d8 C) z% p
document.write('</td></table>')
9 p/ W: n9 D3 x' Q4 F}' V: e: Z* J- a: b
}% u$ I! q0 |/ Z' ^2 s
</script> |
|