返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% ?: a3 L9 E) a2 o8 Y  F& t0 @9 qvar marqueewidth=300
7 Z! l, D, U7 q7 I//高度
1 S; P" m- Z* Z& U% l. `1 h; }var marqueeheight=25
/ E% W8 G, d& l" |# O# C//速度(1-10)3 S3 [' j0 }" C* G' `. {6 r% R' t
var marqueespeed=3
& _; V; O+ g) G) j) ]//背景颜色# _: n$ P& S& Y% A
var marqueebgcolor="#FFFFFF"
. Z; g+ a  X! _) t8 ~: F: a//是否能暂停 (0=no. 1=yes)?
* q: K: w3 j: X& s& U8 x' Pvar pauseit=1
8 f  z1 ^9 g# {( W: V8 x6 |2 s$ M. P' n0 a) `- k0 A0 o
//修改显示内容2 q. O; x. I% _! n, J' L& b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  c/ Q6 N2 ]7 i* D( A  r3 m4 n

6 k0 w' ^7 i- e1 s. P
/ P. M+ ?7 ^# G. Z  R////下面不需改变////////////( S$ Z( `' A2 a$ D0 [/ X/ s
" ?0 s0 w4 w2 Z! R1 w7 t' A( J3 a! l
var copyspeed=marqueespeed
. ?7 P& @3 a! A" o* f  i( I9 q  l. Hvar pausespeed=(pauseit==0)? copyspeed: 0
* J- f- s. [+ t6 Pvar iedom=document.all||document.getElementById
( s6 i& z& [- ]if (iedom). `: t( N, W8 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ k$ x" y+ ]% ?var actualwidth=''4 Y# N! u0 Z$ e: t
var cross_marquee, ns_marquee' u% j4 r1 `1 |  [( z0 M
4 I) s5 v: ?9 M- y2 a9 u. g7 F, _
function populate(){: G( w3 x* D" x  x6 D1 o
if (iedom){
9 E+ }& l' H, \2 C( |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 C7 D, h$ @, r, m* Jcross_marquee.style.left=marqueewidth+8$ `7 ]$ S4 z) y) G7 p; w% b* n
cross_marquee.innerHTML=marqueecontent
& Q9 l$ K8 @* s! S6 J7 M1 Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' J) y* T& g2 o" ]; r}6 [3 u, r* O) C! L" q7 `% E& M1 P
else if (document.layers){
: |" T# B- b$ ons_marquee=document.ns_marquee.document.ns_marquee2
. h6 D0 Q9 t- f8 f  hns_marquee.left=marqueewidth+8. b* y" }& B" k# z8 h4 d
ns_marquee.document.write(marqueecontent)
) p' b9 G9 L- X( |ns_marquee.document.close()
% Q+ E3 i  J% q& Y- X# Zactualwidth=ns_marquee.document.width2 q; C# W! ?8 r) Y* v7 C
}
. K4 g6 J: r3 N4 a. Zlefttime=setInterval("scrollmarquee()",20)
! s$ d. l+ m5 S  ~- ~}
2 C7 u% d: ]2 }6 K3 cwindow.onload=populate( w) _# L+ `" J4 ^* _# o
, K+ P& Y+ }3 b, S& {. v) X7 O
function scrollmarquee(){
! C$ e/ N! R3 Qif (iedom){& K& I" @9 b3 G3 s- S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# ]4 ?$ i( p& k0 I, j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  G+ F0 j! z. L" g& U  q
else' T" W+ ^$ a4 L: L) d" v4 v
cross_marquee.style.left=marqueewidth+8
: E+ F4 v" w8 b, q: k# N- `6 O' |# q: i; v! T9 F/ e5 c5 `
}. {: O5 W  r2 g* e2 b$ r: v, x
else if (document.layers){# H& s5 |/ V3 k1 E* X
if (ns_marquee.left>(actualwidth*(-1)+8))
$ Q2 v" @0 T& w: ~: c9 Qns_marquee.left-=copyspeed# ]5 o/ {  k1 c% f) H7 B+ ^
else2 W* w& O# B4 }+ \4 J8 n4 q2 s
ns_marquee.left=marqueewidth+8
, `0 ^1 w& _" |& r}
! g# f: v% }( z- Q2 u/ u9 W4 V}9 ~4 Z/ Y; [) j$ y; U
' O% A) ?8 `8 u
if (iedom||document.layers){
' _2 h, E0 \6 nwith (document){
4 p/ u# R7 W- f1 T; O3 D, ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 L- x+ d6 J& ?9 N* s7 ?9 L0 Q  D0 Cif (iedom){
  e, P2 c, z. w) c" Q6 bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  K* x  U, c, K& y" wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 o+ Q8 \* n8 c* k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% {. |! V1 |) I- ~# u2 o9 K2 y
write('</div>')
2 U9 [" K) ^) _6 A4 V! |}
1 B- F% x" O+ C2 G3 L' K  eelse if (document.layers){( ^0 b1 b- i( @8 T2 N$ _% X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ z* c8 T& h6 M9 V( {8 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& e5 V( S( `& K9 e! d" H2 q2 dwrite('</ilayer>')1 W( c0 d, J/ l0 U/ P: g5 M
}, z/ z1 N+ Y8 c4 k& o) @
document.write('</td></table>')8 j4 c& z6 n0 T3 {) u; M
}
  `" [. E+ d4 M! @}
+ {5 q; U. q$ K# u8 n</script>

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