返回列表 发帖

网页之跑马灯文字特效

//修改宽度) z7 C9 g/ b) p8 G
var marqueewidth=300- q" [6 B4 U, I, r
//高度
' v) o6 E3 q; lvar marqueeheight=25
1 q4 }- ]% L) G$ p* V1 z7 ]//速度(1-10)
) H  G* V( l; k& Z, K" cvar marqueespeed=31 I" t. f. m- A: H3 n
//背景颜色8 P  m) J" y9 o* s/ H1 P1 E
var marqueebgcolor="#FFFFFF"
7 U0 I  e3 X1 t% j% _' F# u& q//是否能暂停 (0=no. 1=yes)?' T4 H6 e% k' V; g. P" @6 \
var pauseit=1
# N# w1 P! `4 k2 m" b6 G( C/ Y: G2 m9 X. Q2 P9 W* ^  p
//修改显示内容
1 T8 x0 F3 S+ I/ ^- svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' A2 |7 ?  \% ?! j( J- K& k+ z& h4 X0 t* G. K. ~* `

5 q* h$ y, N( }2 M0 U2 @  v% t# i////下面不需改变////////////
+ d$ c# C; W" K7 |5 l+ N4 u+ g" n' m* t4 [- u7 }* H
var copyspeed=marqueespeed& x7 N7 F- L; U
var pausespeed=(pauseit==0)? copyspeed: 0
: c4 K% `9 [+ O2 \) Gvar iedom=document.all||document.getElementById
6 @6 n4 ~- U7 T8 ^0 ?. c: m8 oif (iedom)
, {. ^1 k, r& ]6 A6 p* ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% t  B# E: v# x/ s  ^6 }4 V
var actualwidth=''
! |3 W3 `7 [$ b( A2 E$ V7 uvar cross_marquee, ns_marquee5 Q( J& ~& ?; O% m6 _. |$ W
. p) r- Y( v: ~* Q# v
function populate(){
4 p2 ]& z7 i' N. U: x2 wif (iedom){8 ~% [9 b( e8 C6 w; Y; u- n! y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 B" p3 |6 f/ s1 v' |cross_marquee.style.left=marqueewidth+84 S2 ]5 l1 u1 D
cross_marquee.innerHTML=marqueecontent
6 j4 e2 h+ l: |* _4 f! W7 Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 C$ S! y  O! T% i: ]+ I}1 W  `% L7 z  Q, L: A0 w
else if (document.layers){
3 U" r: |6 i8 l- S. v4 Tns_marquee=document.ns_marquee.document.ns_marquee2
( S* l! L2 o! n% f  H+ kns_marquee.left=marqueewidth+8
3 t: x9 T" e% e6 `+ w2 Sns_marquee.document.write(marqueecontent)- C7 u, ~; ^6 r$ p. Y
ns_marquee.document.close()
; p! r; A9 S- B% ^8 P/ @4 [. vactualwidth=ns_marquee.document.width) W7 |, D! D* h7 Y5 t
}5 Q7 z: s& A7 ^* F
lefttime=setInterval("scrollmarquee()",20)0 x) W' p4 K! x0 ?; g% _
}0 O& p" n& n+ \
window.onload=populate
% O) x% I4 `6 K1 S; T4 g# i& H
. X0 _" [, J) M# Mfunction scrollmarquee(){
( d: h$ F+ D, B5 C& nif (iedom){
9 Y5 c  D8 v# B- r% v( {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! ]/ h9 x/ }  S* L8 d  L% V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 j8 S4 d  h- G% Helse# {) t( Q6 q' ~3 U* L! @
cross_marquee.style.left=marqueewidth+8
( L1 T7 A  S7 ?" ^8 y3 H( k" R$ G6 v
! g: _6 X, \: j& A' c: `+ t}7 w+ @: P( ^8 l2 t- g3 t( c4 u
else if (document.layers){# t  S9 v( t2 g( ^" `# f3 O1 l  q
if (ns_marquee.left>(actualwidth*(-1)+8))
8 @7 e! r' |) C$ fns_marquee.left-=copyspeed/ s6 N( K' F" c; P: U! r8 S5 d! i  s
else8 v1 L8 h# S5 a2 W
ns_marquee.left=marqueewidth+8
" H& |4 r, B) D& i2 R* c}
$ Z, W) `3 H7 t}' f5 ?- S2 w8 d$ F+ y9 y
& B2 r  w* n2 w4 y% Z  W1 A- Y
if (iedom||document.layers){
% t, b8 y0 o, q; }) {with (document){
$ i% P2 ^/ m3 V3 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) Q& Y4 A" v0 `- p' E  R1 d! k
if (iedom){
; M, D2 o' M' i6 q( N% @) twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" y. z. n* a. z5 P- ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! _# i8 m4 ~& v) H, G  L$ Y$ Y+ Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( x  X( h2 I: }: I. N  G6 Gwrite('</div>')
" Y$ R' D! d2 a: n}" [7 G( _. H" }, y: k2 s, R
else if (document.layers){. i9 G* Q. D$ r) u
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% G* {; E- D; j4 {( J, P% zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 b& A8 b( D; e+ O9 s
write('</ilayer>')
4 ^; |1 j7 ~4 k, ]0 |}
. s% R. a2 y% {document.write('</td></table>')
1 m% ?, ~. Z4 b}8 ^' J& O  F0 R5 T& ^$ v$ z
}
- {* [$ u& A* I( ?. ^" U; T+ ?</script>

返回列表
【捌玖网络】已经运行: