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

|
网页之跑马灯文字特效
//修改宽度
4 e1 g# U2 W2 Y. Svar marqueewidth=3005 M4 s9 r/ Y$ b& D$ x
//高度/ F5 k |* Q5 M" y
var marqueeheight=257 H" F- F0 Q$ l4 \6 e& D/ _, g* _
//速度(1-10)
8 g' t. t/ H- s. S# Rvar marqueespeed=38 k. H* [; E4 B% d
//背景颜色5 F4 l9 j) a' N% I& c3 a- s) `4 O9 i
var marqueebgcolor="#FFFFFF"1 \3 Q. D/ H' V# n) ]
//是否能暂停 (0=no. 1=yes)?4 l# P) i6 w! [1 S t% u
var pauseit=1/ o7 b. v$ D5 |- [( w! r( B
, ?9 S( H5 R7 j* v! N//修改显示内容
! {" L a( K' T" O0 @$ Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ Q* A# H6 F. s3 O- e7 |- k6 X6 ], c& _
S+ X# g- b2 Q) U% U////下面不需改变////////////: r9 i9 ~+ z) @% B* {
# \' o, a% y2 l% ]+ L3 z
var copyspeed=marqueespeed# O/ Y8 X6 ~8 M L& C+ R# N8 A
var pausespeed=(pauseit==0)? copyspeed: 0; ]1 o$ w2 q5 x) S' C
var iedom=document.all||document.getElementById! ^0 H( b% i2 h; j
if (iedom)6 {8 ]2 m$ y" B V3 L1 N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 ^1 Y" @) }7 y+ i
var actualwidth=''
9 {. D3 ]' Z/ j" J! ?0 ^; cvar cross_marquee, ns_marquee
% e' }1 w& O8 n6 y' `9 Q7 I# Z! ^
/ l e- n" A! q- a) C1 l( s6 B3 M" f) zfunction populate(){
d2 J, r/ q3 D- }9 D% cif (iedom){6 r- j) w/ V/ Q2 Q5 {( X5 u! E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 M4 D( S0 @ ~3 L" @5 j1 T/ e. w
cross_marquee.style.left=marqueewidth+83 J7 |4 y/ T R/ b8 S- V
cross_marquee.innerHTML=marqueecontent
1 t- u& g6 ?; C9 H7 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" [, Z9 g' A. W3 j( z: C
}
# a' D7 x) L/ R! f; ^else if (document.layers){
h; N g2 z. \ns_marquee=document.ns_marquee.document.ns_marquee23 T) G" A4 n( d' D7 o0 p/ r8 \
ns_marquee.left=marqueewidth+8! M! @$ g- I' H9 M. `& c7 ~
ns_marquee.document.write(marqueecontent)
: F' p+ f& N5 O% \8 sns_marquee.document.close(). `, `- k# `7 p% Y6 y# \
actualwidth=ns_marquee.document.width
4 b1 I/ H+ E* Q6 }( \2 }}5 \1 h/ u3 K* k' I6 ]% x
lefttime=setInterval("scrollmarquee()",20). v, l( s& R) W$ y
}" Q) [& K( {( \
window.onload=populate
6 i' L" U8 [# [! p- ` I( k3 Y- f) `( l, ]4 P
function scrollmarquee(){8 ?+ n6 Y8 a" H' O6 m8 [2 j+ G
if (iedom){
; p0 @, W, p6 B, t& Q* Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' }- V( V: c6 u0 C! B0 Q# \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- q; q1 H0 P: l% h6 I. t
else" Q. h# q2 o9 f& y- S
cross_marquee.style.left=marqueewidth+83 F, d4 `- @! F6 r M
3 |/ s! A( P# f
}. m' N- Z$ v8 v, @8 C% S
else if (document.layers){7 [2 Q1 m! j1 d0 K8 u! ?
if (ns_marquee.left>(actualwidth*(-1)+8))
4 q, J7 c2 H6 S+ ^; R+ g. lns_marquee.left-=copyspeed% \6 K, w/ r4 w$ C& D
else" y1 _1 v2 d5 e. L5 P% I C0 F
ns_marquee.left=marqueewidth+8$ @& P- A) z* t& w. u D0 k3 b5 A
}( h$ |5 x/ Y2 Z& D- H
}' B! I" |. }. R: k/ ]
( W* Z9 r$ Q6 a3 j0 K% T0 j
if (iedom||document.layers){
! y; {2 j# W: h7 fwith (document){
W- }. P. a4 g5 g+ ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ F3 Z& @" l% b5 @8 h( b9 Pif (iedom){7 F( X! {7 `! [2 y4 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 s4 e, t$ ~ s, T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, Z3 H) D, X, _7 h5 w4 [- Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 M9 k1 {' _- Awrite('</div>')
6 \* W+ i( K% C* T6 x: s7 Z) a}
6 B% r1 z$ V6 U& T; a, j, Qelse if (document.layers){& y$ N' \# z" E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' t- L2 |6 ]+ K& W2 j5 h$ ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 i B' u/ {) C' r# A, ]: B) _4 Fwrite('</ilayer>')6 v( ]2 y! c" u- S% G6 f
}
& H, \; @* k: B4 u! ddocument.write('</td></table>')* ~+ d/ d& ]! `
}
: Y" K% ^8 i2 y; @- A) [}1 k1 w& Y% Y' n2 Z
</script> |
|