设置层高,比如position:absoulutez-index:999top:100pxright:0px
示例用法:
<html>
<head><title>123</title></head>
<body style="width:1024pxheight:2000px">
<p style="width:100pxheight:100pxbackground-color:red position:fixedz-index:999top:100pxright:0px">
<img src="图片地址" />
<p>
</body>
</html>
图片中的P标签里有图片,我这里设置P区块为宽高各100,用position:fixed定位,距离顶部100像素,右边0像素漂浮着,z-index:999就是层高,可以理解为层高越高就可以漂浮在网页上面。
效果如下:
不管如何滚动网页滚动条 上下翻 左右翻都一直在屏幕距离顶部100像素,右边0像素漂浮着。
这个还不容易啊 把这段代码放进去就可以了啊<div id="demo" style="overflow:hiddenwidth:978pxheight:124px" align=center >
<table border="0" cellpadding="0" cellspacing="0" align="left" style="margin:0padding:0">
<tr valign=top >
<td id="marquePic1">
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" style="margin:0padding:0">
<tr>
<td><ul>
<a href="/cpzs/tzcxl/qzc/1582.html" target="_blank"><img src="/Upfile/20111011/2011101166103633.jpg" alt="江淮清障车" width="550" height="300" /></a>
<h4><a href="/cpzs/tzcxl/qzc/1582.html" title="江淮清障车" target="_blank">江淮清障车</a></h4>
</ul></td>
<td><ul>
<a href="/cpzs/tzcxl/bpqcysccc/1478.html" target="_blank"><img src="/Upfile/2011816/2011081648714933.jpg" alt="东风小霸王爆破器材运输车" width="550" height="300" /></a>
<h4><a href="/cpzs/tzcxl/bpqcysccc/1478.html" title="东风小霸王爆破器材运输车" target="_blank">东风小霸王爆破器…</a></h4>
</ul></td>
<td><ul>
<a href="/cpzs/tzcxl/bpqcysccc/1477.html" target="_blank"><img src="/Upfile/2011816/2011081648714933.jpg" alt="CLW5051XQY3型爆破器材运输车" width="550" height="300" /></a>
<h4><a href="/cpzs/tzcxl/bpqcysccc/1477.html" title="CLW5051XQY3型爆破器材运输车" target="_blank">CLW5051XQY3型爆破…</a></h4>
</ul></td>
<td><ul>
<a href="/cpzs/yougcxl/ygcc/1383.html" target="_blank"><img src="/Upfile/20101125/2010112551620205.jpg" alt="东风多利卡加油车" width="550" height="300" /></a>
<h4><a href="/cpzs/yougcxl/ygcc/1383.html" title="东风多利卡加油车" target="_blank">东风多利卡加油车…</a></h4>
</ul></td>
<td><ul>
<a href="/cpzs/tzcxl/bpqcysccc/544.html" target="_blank"><img src="/Up_files/201056/2010050654322689.jpg" alt="东风天锦爆破器材运输车" width="550" height="300" /></a>
<h4><a href="/cpzs/tzcxl/bpqcysccc/544.html" title="东风天锦爆破器材运输车" target="_blank">东风天锦爆破器材…</a></h4>
</ul></td>
<td><ul>
<a href="/cpzs/yougcxl/ygcc/92.html" target="_blank"><img src="/up_files/20081020151033758.jpg" alt="东风153加油车=运油车" width="550" height="300" /></a>
<h4><a href="/cpzs/yougcxl/ygcc/92.html" title="东风153加油车=运油车" target="_blank">东风153加油车=运…</a></h4>
</ul></td>
</tr>
</table>
</td>
<td id="marquePic2" valign="top"></td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=10
marquePic2.innerHTML=marquePic1.innerHTML
function Marquee(){
if(demo.scrollLeft >= marquePic1.scrollWidth){
demo.scrollLeft=0
}else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)