网页图片跑马灯代码,自己插入图片就可以用的那种啊~~
发布网友
发布时间:2022-04-30 07:04
我来回答
共1个回答
热心网友
时间:2022-04-20 21:17
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: center;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<script type="text/javascript">
function change1()
{
document.getElementById("i").src = "http://www.codefans.net/jscss/demoimg/wall_s1.jpg";
}
function change2()
{
document.getElementById("i").src = "http://www.codefans.net/jscss/demoimg/wall_s2.jpg";
}
function change3()
{
document.getElementById("i").src = "http://www.codefans.net/jscss/demoimg/wall_s3.jpg";
}
function change4()
{
document.getElementById("i").src = "http://codefans.net/jscss/demoimg/wall_s4.jpg";
}
function change5()
{
document.getElementById("i").src = "http://codefans.net/jscss/demoimg/wall_s5.jpg";
}
function change6()
{
document.getElementById("i").src = "http://codefans.net/jscss/demoimg/wall_s6.jpg";
}
</script>
</head>
<body>
<table align="center">
<tr>
<td align="center">
<div id="demo" align="center">
<div id="indemo">
<div id="demo1" align="center">
<a href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s1.jpg" border="0" onclick="change1();" /></a>
<a href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s2.jpg" border="0" onclick="change2();"/></a>
<a href="#"><img src="http://www.codefans.net/jscss/demoimg/wall_s3.jpg" border="0" onclick="change3();"/></a>
<a href="#"><img src="http://codefans.net/jscss/demoimg/wall_s4.jpg" border="0" onclick="change4();"/></a>
<a href="#"><img src="http://codefans.net/jscss/demoimg/wall_s5.jpg" border="0" onclick="change5();"/></a>
<a href="#"><img src="http://codefans.net/jscss/demoimg/wall_s6.jpg" border="0" onclick="change6();"/></a>
</div>
<div id="demo2" align="center"></div>
</div>
</div>
<script>
<!--
var speed=10;
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth;
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>
</td>
</tr>
<tr>
<td>
<div align="center" ><img name="i" src="http://www.codefans.net/jscss/demoimg/wall_s1.jpg"></div>
</td>
</tr>
</table>
</body>
</html>
自己修改那个src的路径就可以了