返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ z2 H+ S9 a6 C1 O5 Y+ bvar marqueewidth=3009 I% w! y: ~* N& b- _. E/ q
//高度& X. y. O. u  M' I( M7 Y
var marqueeheight=25
9 y# V  m6 Q8 T9 C/ C, ]//速度(1-10)
& o. e( ?. j9 lvar marqueespeed=3
' Z. c3 U) j1 U# l+ r2 w//背景颜色& h/ R/ t& T( w6 f
var marqueebgcolor="#FFFFFF"$ K1 Q, h2 N9 B7 x; K3 `
//是否能暂停 (0=no. 1=yes)?
# t7 d) Q" s" \* N+ Pvar pauseit=1
" a$ r1 }$ m9 r; e3 X. ~. j* [
3 n5 V, U. v8 K) Y# w; I//修改显示内容
/ g2 E( W- P6 A. F. D( F$ Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- b9 K3 |6 O' c2 c) R

7 y7 M4 B: f1 y3 ]6 h
8 s0 u3 h. ^0 P5 o- s////下面不需改变////////////
. H* r1 A/ V* D6 |) B
$ l; C1 B- f; _, Vvar copyspeed=marqueespeed
* P1 W. [& Z, r  ?* Z% C* Tvar pausespeed=(pauseit==0)? copyspeed: 0
6 `7 ]* F$ z0 q6 Rvar iedom=document.all||document.getElementById
* K( s" y1 R! g4 l5 G: v, Tif (iedom)
. h( S/ ]  |; i8 I# @3 |6 c3 cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 s0 D2 Z9 _! L0 i, M3 D, Y
var actualwidth=''7 ]" n7 H# X) Y9 J
var cross_marquee, ns_marquee% Z' _# B9 J( x4 _- C, t

1 ^6 T, M- Z* N, G# z3 K5 V! efunction populate(){
4 P% y' s' }3 ^9 y7 Fif (iedom){
# Q* T+ t8 ]$ ~! i- _! ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& N, X% f+ S) a4 a9 b( g8 ]! |
cross_marquee.style.left=marqueewidth+8
" |; E7 e0 l3 a$ m3 C2 ]cross_marquee.innerHTML=marqueecontent  D. U! w- L  V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; X7 |! i0 d! @; R& a- k; ^/ S
}
2 X( R2 W: Y$ }# ?1 c: Lelse if (document.layers){
2 h% M8 O8 D3 @' V- ~5 ~6 g6 D7 sns_marquee=document.ns_marquee.document.ns_marquee23 s. _3 G) m2 J, k/ H' \
ns_marquee.left=marqueewidth+8
$ J/ t. L* ^$ P) C% a6 k: Hns_marquee.document.write(marqueecontent)1 D8 p! L* U5 l. R0 O1 N4 ]
ns_marquee.document.close()
2 o# N  Q8 v/ ^actualwidth=ns_marquee.document.width
6 M8 T9 l8 @8 a1 u& d; H5 z}
/ s& s6 r) [( klefttime=setInterval("scrollmarquee()",20)
: s3 h6 l7 I2 g; _}! D2 Y" `% J4 [- Q
window.onload=populate
% _. R7 ]1 w0 E
9 H! l% W8 e. s; i3 {1 ?function scrollmarquee(){
: O  r9 R; V. [& \if (iedom){- Z4 j& w5 E7 m8 R' }& P1 \, {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 ~2 e0 |( |  Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 n/ g! O" t; S" z2 pelse$ [; S' \0 ^) p9 D1 |
cross_marquee.style.left=marqueewidth+8
. t+ P+ j- n5 E1 T7 `5 M. C' k5 I* F+ U8 p/ b: h2 k* [
}$ }! d# G8 n3 T
else if (document.layers){
6 ~+ b# x- w/ y9 u( O/ w2 uif (ns_marquee.left>(actualwidth*(-1)+8))
1 A; g# W0 ^, E; A- C% xns_marquee.left-=copyspeed6 E: ?$ H) E" d3 f, R% V& Z
else' ]/ }$ ^' z5 g/ u  I' C
ns_marquee.left=marqueewidth+88 p: s& l2 q( H. P2 s/ \
}. x' F* I. d* ?4 p# t$ A
}+ H8 P0 B6 t' g7 h5 ]

4 N) L2 W, \7 i  H+ b3 jif (iedom||document.layers){% @3 f8 Z! ^, R* j
with (document){
/ N/ s* F# |/ z" T" D' Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" n- F: w8 k& Wif (iedom){7 p3 V  k$ I7 r, T) P! \) b1 T9 z/ v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). t3 }$ J; d: X) {4 a- `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), P' B6 E, d- q7 C% U$ `  s- g$ y" z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 l9 W# a- |0 @1 R# L; j4 b5 g) e
write('</div>')
( {. Z6 e. L/ d}
  p- {! o9 F! ]! jelse if (document.layers){
7 e4 j" y3 L# q, D! c' vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! \$ F: n6 |( p4 A5 ^4 J: _8 e: F; m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ T! g- w# B. i1 t
write('</ilayer>')
2 r0 q0 H: O  v3 g}
) \8 B, X! d5 i. vdocument.write('</td></table>')
+ B# [, [$ `& N  N. E- u}% T" w% n- x9 c% D& k* C3 z
}7 ~9 Z% r0 b5 a- `6 V! O4 {
</script>

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