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

|
网页之跑马灯文字特效
//修改宽度$ |% m# [+ J' V- Z
var marqueewidth=300
1 F* x1 i; T. [: B! m//高度
' K& u9 H( `" v5 z( q; }var marqueeheight=25
) l: V' q* u- M7 f//速度(1-10)
, R) Y8 j2 w( x) W D1 Uvar marqueespeed=32 n/ K7 y. [: E/ F
//背景颜色( x5 p* Q, v6 Q- v8 ^7 D# l8 ^: x
var marqueebgcolor="#FFFFFF". A1 G4 x7 N. K/ c8 r4 ^0 r
//是否能暂停 (0=no. 1=yes)?$ Z8 a. U- W `+ ?4 @2 X3 d9 K
var pauseit=1
9 F. {3 W1 C0 @
6 u- E5 Z( C7 i. V//修改显示内容" W8 }" Y' q7 {, i9 e0 |" Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 `# I5 Z; l7 ~3 Q5 a% n |
- v* F1 ~: s* U1 D# w4 L& h6 Y0 f
3 X- W4 @5 h* p& u# X////下面不需改变////////////
3 C" n$ d# }+ ]5 Z' m# [# F! V& y& P
var copyspeed=marqueespeed6 V7 s2 F! C$ M/ E9 j+ S$ [+ Q) Q% n
var pausespeed=(pauseit==0)? copyspeed: 0' @+ `! I: Y# @& i5 p
var iedom=document.all||document.getElementById) M: n8 d- ^ F, R% z% n
if (iedom)& [! B9 b6 O, o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ f6 U+ j' a ]6 V. Z: L
var actualwidth='', A$ _1 g: K9 E- c% h5 E- G- o
var cross_marquee, ns_marquee
: t3 ?# ^0 G% b. M: T; [9 a; m) s* Z K5 V8 B0 X! n" E9 }" ~$ P
function populate(){
( s* F: [# M+ P1 Lif (iedom){
( a5 u. L, C6 U9 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! Q9 \ X7 C2 X6 K9 g6 c! g7 a+ ccross_marquee.style.left=marqueewidth+8; {7 `0 q& a0 Z+ G8 J1 j
cross_marquee.innerHTML=marqueecontent
: X4 u5 I+ F" U9 b5 V8 w+ lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. D( ^: X" p& O7 ?
}
( {( @* h, F* y! Pelse if (document.layers){6 ~. Y0 r2 x/ W7 c; p
ns_marquee=document.ns_marquee.document.ns_marquee2
8 N: n! _' L4 wns_marquee.left=marqueewidth+8" P2 L2 }5 V1 g' J# W8 s, M& _
ns_marquee.document.write(marqueecontent)
' M2 J" ]4 V7 D% \* Cns_marquee.document.close()4 X; V4 u8 t9 u5 R
actualwidth=ns_marquee.document.width
7 j2 f* F% \7 c$ j, E4 s}
0 ^4 [: J$ V3 }, ?, O( Vlefttime=setInterval("scrollmarquee()",20)
) z# D% L3 f9 q}! ]* v) i# w7 ]1 I% p
window.onload=populate
0 K8 X) p" p3 S# p5 y
) K W! V: H) m- I7 U0 @& rfunction scrollmarquee(){
" ~) Y1 A# k5 k8 I, l' yif (iedom){
$ @( @9 l& Q8 s* \ Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# i2 T" }, m" d, j8 b# Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& Z9 f0 N8 W t+ V7 f
else
1 W2 m8 k/ p0 [: Y, w8 S8 Icross_marquee.style.left=marqueewidth+8
4 U) M( g0 @: ]6 K5 o* F
: U/ Q* i( r6 k3 v) p}6 a e! I8 L+ _5 o% d
else if (document.layers){7 c* p# Z1 w8 t/ d4 y6 A% l
if (ns_marquee.left>(actualwidth*(-1)+8))8 }/ T3 n8 \- w1 N5 T
ns_marquee.left-=copyspeed
4 P& }) p- A8 H9 _5 u% Yelse1 T# h3 Y& H2 w" A& I9 S; ^
ns_marquee.left=marqueewidth+8
' X- m9 U' \2 s( H; ~9 ^& K3 H}
' q! P& m* p7 k! u}
+ U; M, C& N1 a U& z& S& x g# K4 \: l: p$ n; {
if (iedom||document.layers){' I+ P$ ^8 V2 I
with (document){/ \6 x# X' N. B4 Y. t( {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 t& s/ D# E9 K) r7 m1 i
if (iedom){* D( t; S' |' l( Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) e% Z; @, C7 p# |0 w! y) x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" D# N% x3 I' p& |$ zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! c. B, T. T9 T# C+ k- l( {
write('</div>')
# Z+ c0 b: N5 t5 V" P& F4 m/ {- f7 p0 x6 r}
4 ?, y# N# E; s3 y0 C; f pelse if (document.layers){+ p1 s: J# t( ?0 h. Z9 h& Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) o+ b/ F9 d" h% ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 }+ ]8 }1 c( @9 |( O/ q' hwrite('</ilayer>')
7 H. H: n: @# r0 C7 R$ {9 f1 m7 s}1 u) s8 ^; H. f" o" z/ K
document.write('</td></table>')
7 n. Q; x# C; g- D) ?2 D0 p& j f$ u}
6 a1 b# e: V6 W& a}
4 u% a/ X5 k/ J: v- O% @" e</script> |
|