返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 c4 W; Q% o+ j" _var marqueewidth=300$ R) z' p+ M1 ]- {4 `5 l
//高度
, Z, P3 q5 r( ^9 K* X' _var marqueeheight=25
5 L8 }7 w. P- P% c1 ?, z. J//速度(1-10)
0 a$ \5 [" n! ]5 j  ^# B# ovar marqueespeed=37 U  h. c0 a& v# `4 m5 N& a9 n0 g
//背景颜色
$ q0 w6 t. w; k$ u/ evar marqueebgcolor="#FFFFFF". g3 ]# U; _' H" T
//是否能暂停 (0=no. 1=yes)?
9 h( [7 \  j' s- r, R, D# e6 {0 M- ivar pauseit=14 h% D; H  Z' D" l. Y
( d$ V0 L6 P! s& x
//修改显示内容- v; K5 _1 `2 S3 V' r9 i' L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* v: i- W, W1 V3 ^

$ [" \/ C% N& p! d, s- j, }
* T. g: x& D9 ?  W$ \1 v. D////下面不需改变////////////" v- W; }& G8 _7 |0 a

( T  ?6 G; B: K: Y; s$ d( |4 J* Cvar copyspeed=marqueespeed
& D7 ]8 L2 j" ]2 @3 t3 Kvar pausespeed=(pauseit==0)? copyspeed: 0& |4 C9 Q: i) [6 [
var iedom=document.all||document.getElementById
+ ~4 ~6 G4 q3 s! Z  \if (iedom)+ e) C% Z+ }& _. t0 ?; c) i& v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! d% @0 `# Z" X  \# t
var actualwidth=''
8 A2 L0 n1 S) z; @var cross_marquee, ns_marquee( Q; S+ y0 y+ b. W; V5 `( G

! z) [  Y" @4 @. efunction populate(){
8 u. g) f* s  T2 Q3 l2 Yif (iedom){! ]0 A6 ]0 P$ W- w  x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" {# @9 R  S4 O" n, q
cross_marquee.style.left=marqueewidth+8
2 r# E* v. C' X# t5 Vcross_marquee.innerHTML=marqueecontent2 M, i- n+ D. f' U9 J4 q% a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 A2 c4 a: w" [* H}! `9 b0 @2 F, y3 P8 @& t9 m$ h
else if (document.layers){5 v1 ?8 p3 \+ w- T! S3 @0 o: {! {
ns_marquee=document.ns_marquee.document.ns_marquee2
( v4 c$ c6 r5 c0 _! Z, L5 _' [ns_marquee.left=marqueewidth+8
: L+ n: M$ c9 p  J" Zns_marquee.document.write(marqueecontent)
4 H7 q( e5 m  Y! hns_marquee.document.close()
9 L' W( e/ N$ e0 b! e! s/ wactualwidth=ns_marquee.document.width( k7 K7 y# g# S! \# `
}  \/ H3 c% N# [3 {8 F4 c
lefttime=setInterval("scrollmarquee()",20)4 \; I  F- W; E! I7 w9 T0 H
}3 a9 K/ h" R3 O& T! w
window.onload=populate0 e8 ~" o4 _9 l4 q
" Y0 T! r' q6 ~' v4 Q2 h2 o4 b
function scrollmarquee(){
* u9 L$ P& r' O: ]0 Uif (iedom){. B3 s  M, U8 W) K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' X* \9 {8 k  H  o; qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. _  D3 s% k, Y: y0 h
else( O  ]9 @' D; y4 n; X
cross_marquee.style.left=marqueewidth+8# v& d8 U5 G3 u( g% @. N' m4 u

) }  L" M  ~; w' D! k( b5 ~/ S}
! z2 }2 S) f" g3 S# kelse if (document.layers){
; ?  l7 L* f& b" q* fif (ns_marquee.left>(actualwidth*(-1)+8))6 b, N7 d/ ^3 f- f
ns_marquee.left-=copyspeed
8 m6 ?( M" b3 M. K) S4 J2 telse8 o% M& L: S; P6 |' B0 h! x- Y! V
ns_marquee.left=marqueewidth+8. j( `9 l) U! I6 {5 b
}
# }# m" B. y1 B  Z$ }$ W}
5 \4 E% z/ u1 s. g) b# H+ W& o- f0 U# K7 b- [: E6 o4 W
if (iedom||document.layers){
0 Z0 ~% K9 `( N- q- |, Y2 e; c( |with (document){
9 L; {  y( \9 J/ _0 _$ D" e4 K) Cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). ^6 D! D! x# M9 N9 K8 F5 W
if (iedom){
- _0 J6 q+ ?3 n  ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 \4 T  `7 W4 g! n7 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ H  J4 t1 A% t+ A7 n4 zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ b" n- n* z" ~, E1 |
write('</div>')2 h: J/ B8 n8 x% ^  P
}" X7 D0 k2 R$ w+ i4 x/ A1 E
else if (document.layers){5 ?* n' x( w% _4 l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. ?$ i' K3 w% R0 D( d: }( o! `0 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ ]# q7 f. f1 V( ?3 {0 wwrite('</ilayer>')
. n5 g! E4 ^) h5 N" ~) z}, K& Y4 b) g* ^/ D- k' N5 T
document.write('</td></table>')
6 Y+ a8 [) N1 @% N5 W6 s  `; [2 ]}
3 g: p: [/ u7 D}
9 q- W3 Q) z, S3 ?* `</script>

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