首页上一页 1 下一页尾页 1 条记录 1/1页
图像的手动播放
发表在PHP图书答疑
2015-12-21
是否精华
是
否
版块置顶:
是
否
老师您好,我买的书是《PHP程序开发范例宝典》,其中第13章中13.3节的实例334图像的手动播放,书中的例子如下,在电脑中运行正常,但我修改到自己的文件中就不能实现了,其实也就加了个网页的标准什么的,把书的例子放在body标签中间就不能运行了(修改的例子也如下),不知道这是怎么回事?希望老师能解答,谢谢!
我主要是想在mysql中下载图片(比如下载10个图片),实现手动播放(比如在div中先显示4张,按一下向左或向右再显示另外的4张)
书上的例子
<table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000FF"><table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF"><div id="demo" style="OVERFLOW: hidden; WIDTH: 566px; HEIGHT: 176px" >
<table cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td id="demo1"> <img height="175" src="images/1.jpg" width="143" border="0" />
<img height="175" src="images/2.jpg" width="143" border="0" />
<img height="175" src="images/3.jpg" width="143" border="0" />
<img height="175" src="images/4.jpg" width="143" border="0" />
<img height="175" src="images/5.jpg" width="143" border="0" />
<img height="175" src="images/6.jpg" width="143" border="0" />
<img height="175" src="images/7.jpg" width="143" border="0" />
</td>
<td id="demo2"></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<script language="javascript">
function toleft()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft+400;
}
function toright()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft-400;
}
</script>
<table width="200" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="left"><a href="#" onclick="toleft()">向左</a></div></td>
<td width="100"><div align="right"><a href="#" onclick="toright()">向右</a></div></td>
</tr>
</table>
修改的例子
<!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>
</head>
<body>
<table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000FF"><table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF"><div id="demo" style="OVERFLOW: hidden; WIDTH: 566px; HEIGHT: 176px" >
<table cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td id="demo1"> <img height="175" src="images/1.jpg" width="143" border="0" />
<img height="175" src="images/2.jpg" width="143" border="0" />
<img height="175" src="images/3.jpg" width="143" border="0" />
<img height="175" src="images/4.jpg" width="143" border="0" />
<img height="175" src="images/5.jpg" width="143" border="0" />
<img height="175" src="images/6.jpg" width="143" border="0" />
<img height="175" src="images/7.jpg" width="143" border="0" />
</td>
<td id="demo2"></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<script language="javascript">
function toleft()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft+400;
}
function toright()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft-400;
}
</script>
<table width="200" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="left"><a href="#" onclick="toleft()">向左</a></div></td>
<td width="100"><div align="right"><a href="#" onclick="toright()">向右</a></div></td>
</tr>
</table>
</body>
</html>
我主要是想在mysql中下载图片(比如下载10个图片),实现手动播放(比如在div中先显示4张,按一下向左或向右再显示另外的4张)
书上的例子
<table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000FF"><table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF"><div id="demo" style="OVERFLOW: hidden; WIDTH: 566px; HEIGHT: 176px" >
<table cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td id="demo1"> <img height="175" src="images/1.jpg" width="143" border="0" />
<img height="175" src="images/2.jpg" width="143" border="0" />
<img height="175" src="images/3.jpg" width="143" border="0" />
<img height="175" src="images/4.jpg" width="143" border="0" />
<img height="175" src="images/5.jpg" width="143" border="0" />
<img height="175" src="images/6.jpg" width="143" border="0" />
<img height="175" src="images/7.jpg" width="143" border="0" />
</td>
<td id="demo2"></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<script language="javascript">
function toleft()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft+400;
}
function toright()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft-400;
}
</script>
<table width="200" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="left"><a href="#" onclick="toleft()">向左</a></div></td>
<td width="100"><div align="right"><a href="#" onclick="toright()">向右</a></div></td>
</tr>
</table>
修改的例子
<!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>
</head>
<body>
<table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000FF"><table width="566" height="170" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#FFFFFF"><div id="demo" style="OVERFLOW: hidden; WIDTH: 566px; HEIGHT: 176px" >
<table cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td id="demo1"> <img height="175" src="images/1.jpg" width="143" border="0" />
<img height="175" src="images/2.jpg" width="143" border="0" />
<img height="175" src="images/3.jpg" width="143" border="0" />
<img height="175" src="images/4.jpg" width="143" border="0" />
<img height="175" src="images/5.jpg" width="143" border="0" />
<img height="175" src="images/6.jpg" width="143" border="0" />
<img height="175" src="images/7.jpg" width="143" border="0" />
</td>
<td id="demo2"></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<script language="javascript">
function toleft()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft+400;
}
function toright()
{
if(demo1.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft=0
else
demo.scrollLeft=demo.scrollLeft-400;
}
</script>
<table width="200" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100"><div align="left"><a href="#" onclick="toleft()">向左</a></div></td>
<td width="100"><div align="right"><a href="#" onclick="toright()">向右</a></div></td>
</tr>
</table>
</body>
</html>