图片加文字循环显示,每次只出现一张,用HTML代码怎样实现?如这个网页中的。
http://www.seiee.sjtu.edu.cn/右边那个“师资介绍”网上有不少仅仅是图片循环的代码,我想要这个页面中的“图片+文字”的效果,但不需要加链接。...
http://www.seiee.sjtu.edu.cn/ 右边那个“师资介绍”
网上有不少仅仅是图片循环的代码,我想要这个页面中的“图片+文字”的效果,但不需要加链接。 展开
网上有不少仅仅是图片循环的代码,我想要这个页面中的“图片+文字”的效果,但不需要加链接。 展开
2个回答
展开全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
img {border:0;}
.colee_div { width:680px;height:150px; overflow:hidden;}
ul.piclist {display:block; width:680px; display:block;}
ul.piclist a,#instore .main ul.piclist a:visited {display:block;text-decoration:none;}
ul.piclist li {text-align:center;width:150px;height:130px;padding:4px;display:inline;margin:10px 10px 0 0;float:left;background:#f9f9f9;border:1px solid #f1f1f1;}
ul.piclist li span {display:block;}
ul.piclist li span.pictxt {margin-top:8px;}
-->
</style>
</head>
<body>
<div id="colee_lefta" class="colee_div">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="colee_lefta1">
<ul class="piclist">
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
</ul>
</td>
<td id="colee_lefta2"> </td>
</tr>
</table>
</div>
<script type="text/javascript">
// JavaScript Document
//使用div时,请保证colee_left2与colee_left1是在同一行上.
var speed = 20; //速度数值越大速度越慢
var colee_lefta2 = document.getElementById("colee_lefta2");
var colee_lefta1 = document.getElementById("colee_lefta1");
var colee_lefta = document.getElementById("colee_lefta");
colee_lefta2.innerHTML = colee_lefta1.innerHTML;
function Marquee1() {
if (colee_lefta2.offsetWidth - colee_lefta.scrollLeft <= 0) { //offsetWidth 是对象的可见宽度
colee_lefta.scrollLeft -= colee_lefta1.offsetWidth; //scrollWidth 是对象的实际内容的宽,不包边线宽度
} else {
colee_lefta.scrollLeft++;
}
}
var MyMar1 = setInterval(Marquee1, speed);
colee_lefta.onmouseover = function() {
clearInterval(MyMar1);
}
colee_lefta.onmouseout = function() {
MyMar1 = setInterval(Marquee1, speed);
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
img {border:0;}
.colee_div { width:680px;height:150px; overflow:hidden;}
ul.piclist {display:block; width:680px; display:block;}
ul.piclist a,#instore .main ul.piclist a:visited {display:block;text-decoration:none;}
ul.piclist li {text-align:center;width:150px;height:130px;padding:4px;display:inline;margin:10px 10px 0 0;float:left;background:#f9f9f9;border:1px solid #f1f1f1;}
ul.piclist li span {display:block;}
ul.piclist li span.pictxt {margin-top:8px;}
-->
</style>
</head>
<body>
<div id="colee_lefta" class="colee_div">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="colee_lefta1">
<ul class="piclist">
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
<li><a href="."><img src="/" /></a><a href="" class="pictxt">sdfsdfsdf</a></li>
</ul>
</td>
<td id="colee_lefta2"> </td>
</tr>
</table>
</div>
<script type="text/javascript">
// JavaScript Document
//使用div时,请保证colee_left2与colee_left1是在同一行上.
var speed = 20; //速度数值越大速度越慢
var colee_lefta2 = document.getElementById("colee_lefta2");
var colee_lefta1 = document.getElementById("colee_lefta1");
var colee_lefta = document.getElementById("colee_lefta");
colee_lefta2.innerHTML = colee_lefta1.innerHTML;
function Marquee1() {
if (colee_lefta2.offsetWidth - colee_lefta.scrollLeft <= 0) { //offsetWidth 是对象的可见宽度
colee_lefta.scrollLeft -= colee_lefta1.offsetWidth; //scrollWidth 是对象的实际内容的宽,不包边线宽度
} else {
colee_lefta.scrollLeft++;
}
}
var MyMar1 = setInterval(Marquee1, speed);
colee_lefta.onmouseover = function() {
clearInterval(MyMar1);
}
colee_lefta.onmouseout = function() {
MyMar1 = setInterval(Marquee1, speed);
}
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询