返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* Q0 X. Q; k# l# wvar marqueewidth=3002 P7 ?& ]# B* O# L9 C7 u
//高度
5 n+ e) Q% F. U9 Uvar marqueeheight=25
: y4 z# q. U+ G//速度(1-10)( Y0 n4 v7 t- _- s9 Y
var marqueespeed=3. g/ e$ Q* n, s2 ~+ b
//背景颜色
/ y8 ]4 u# |6 J& x$ C% t  Y. {var marqueebgcolor="#FFFFFF"
* y9 c; h( ^/ z- `2 `& O8 u% M+ K- T//是否能暂停 (0=no. 1=yes)?
( h2 s* n% h: D& Yvar pauseit=1. O( \6 e: C. L

# e  c/ V; U7 a6 A//修改显示内容
0 k" s1 Q4 W3 cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ e: e+ q1 P6 V8 @/ n

- S) b& [4 j' @) G3 Z
3 Z( w, \4 d6 ^% h7 R- N" B////下面不需改变///////////// h' @# @( \0 l  V, t, G" Y

. U. ^4 G, [& N0 g) T$ G8 Lvar copyspeed=marqueespeed
5 ~  B" b( f' {# r) g3 b7 Z' wvar pausespeed=(pauseit==0)? copyspeed: 0* a. z( A) F& _  v8 D8 _
var iedom=document.all||document.getElementById# V6 K" l' b0 a5 d
if (iedom)1 R/ x& h6 u" H3 n8 w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 A* B9 @! f5 A4 H7 t8 I- bvar actualwidth=''
% n2 G4 v* B' P. R/ {var cross_marquee, ns_marquee
4 `( z: ~9 K7 V9 ~- H/ `* C
) T) \& K$ {, ~; I4 }1 Pfunction populate(){7 S! r4 C" o/ K; z
if (iedom){
& n/ J: b* j; l, M" y0 d0 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ f7 x: p; L* w4 fcross_marquee.style.left=marqueewidth+8
6 C- Q6 v' y0 F- ~- Q3 M% S+ across_marquee.innerHTML=marqueecontent% \; p; c- R* l, p& J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ F# f& M3 }3 g" P+ A2 n' Z}
4 `1 A. R# L: m: \4 ?* B8 B( Velse if (document.layers){
$ c7 M4 n& F, A; C, kns_marquee=document.ns_marquee.document.ns_marquee2
! o/ v4 y3 l5 {1 W( }( ]/ w: u9 dns_marquee.left=marqueewidth+81 G: X4 b7 i& ^: a% u* F5 {
ns_marquee.document.write(marqueecontent): [7 e3 d& G7 Z2 S0 k0 M, q; N
ns_marquee.document.close(), U% i. A, F$ |# e8 \& X# v
actualwidth=ns_marquee.document.width
) c' G9 I0 k/ Z4 }}) _3 x# K, @  e8 c
lefttime=setInterval("scrollmarquee()",20)
% k  Q# ]( o$ S, s( u' f}
/ @( s0 ]0 b4 D  Z9 Ywindow.onload=populate# q# n5 J+ A" W' W5 `" b$ t- g+ g

3 U) ^. z- L0 f* Kfunction scrollmarquee(){
5 @0 F: P, l, ]3 f' J7 Nif (iedom){* ~: i1 h: j* x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ v$ y- F7 Q7 p  @) n2 p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: f, U- m, k7 f
else! b7 C; o& S. `
cross_marquee.style.left=marqueewidth+8$ e9 z) v5 v: |: E$ R( H, r* N! P
( n" n4 M" ]1 Y8 r% O" }% g
}
" t/ U+ i1 n# {* Pelse if (document.layers){$ Q! Z# y. W7 Q5 Y1 n  E/ |
if (ns_marquee.left>(actualwidth*(-1)+8))
5 [& M% w  K1 t- hns_marquee.left-=copyspeed% \2 h. [* Y; ^
else
+ @  j  j$ G- B2 Q0 ~ns_marquee.left=marqueewidth+8) h6 J1 C" l2 I6 v
}
2 y% b5 S0 X0 W6 s+ }3 c}0 X7 v7 n' p4 c/ f- Y
8 B4 E* g" z1 G1 o8 ], Q7 A8 G% B
if (iedom||document.layers){
8 T% ]% b, j: r8 l+ t! Q. A3 mwith (document){6 {/ |% C, X5 R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 D4 `) M0 u" I) r
if (iedom){
- w6 Z. H+ W9 l# w  q+ X9 Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 G/ |: G3 }3 X, {, _* S2 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 r( G0 L* A- ~* H) Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ z$ M( d4 M! X, v6 }) B! `
write('</div>'): `, J3 r6 Y& O# C
}
5 C" _9 L. M$ ~3 h; I5 }( e0 }else if (document.layers){
  J* Y8 V+ T( |+ H+ Z2 Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 ^& O# \+ [7 Y# ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# L+ Y3 V$ c& N3 ewrite('</ilayer>')
8 `, B* p6 c# R$ C( S}
: ?! ^6 l, z5 I9 r9 j0 g! Hdocument.write('</td></table>')
; m6 S! l9 ~4 Y. }}( V  t) {9 f3 Y! c
}
9 L+ }/ n. D  W9 w</script>

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