我的功能似乎没有正确执行。怎么了?我已经花了 5 个小时试图让这个该死的功能发挥作用。最终我将把链接放在照片上。
<html>
<head>
<script type="text/javascript">
var pagenumber=1;
function increase()
{
if(pagenumber == 1)
{
return
}
pagenumber++;
}
function decrease()
{
if(pagenumber == 5)
{
return
}
pagenumber--;
}
function slider() {
if(pagenumber == 1)
{
document.getElementById('pg1').style.display='inline';
document.getElementById('pg2').style.display='none';
document.getElementById('down').style.cursor='not-allowed';
document.getElementById('down').style.background-position='top';
}
if(pagenumber == 2)
{
document.getElementById('pg1').style.display='h';
document.getElementById('pg3').style.display='none';
document.getElementById('pg2').style.display='inline';
document.getElementById('down').style.cursor='pointer';
document.getElementById('down').style.background-position='bottom';
}
if(pagenumber == 3)
{
document.getElementById('pg2').style.display='none';
document.getElementById('pg4').style.display='none';
document.getElementById('pg3').style.display='inline';
}
if(pagenumber == 4)
{
document.getElementById('pg3').style.display='none';
document.getElementById('pg5').style.display='none';
document.getElementById('pg4').style.display='inline';
document.getElementById('down').style.cursor='pointer';
document.getElementById('up').style.background-position='top';
}
if(pagenumber == 5)
{
document.getElementById('pg4').style.display='none';
document.getElementById('pg5').style.display='inline';
document.getElementById('up').style.cursor='not-allowed';
document.getElementById('up').style.background-position='bottom';
}
}
</script>
</head>
<body height="183px" bgcolor="#F3F3F3" style="width:279px">
<div id="down" style="float:left;margin-top:29px;height:27px;width:15px;display:block;cursor:pointer;background:url('website/arrow_left.png') no-repeat top left;background-repeat:no-repeat;background-position:top">
<img src="website/pixel.png" width="15px" height="30px" onclick="decrease()" onclick="slider()">
</div>
<div id="up" style="float:right;margin-top:29px;height:27px;width:15px;display:block;cursor:pointer;background:url('website/arrow_right.png') no-repeat top left;background-repeat:no-repeat;background-position:top">
<img src="website/pixel.png" width="15px" height="30px" onclick="increase()" onclick="slider()">
</div>
<table style="background:url('website/arrow_middle.png') no-repeat center" align="center">
<tr id="pg1" style="display:inline">
<td style="padding-left:25px; padding-right:25px">
<a href="google.com">
<img src="website/oil.jpg" width="75px" height="75px">
</a>
</td>
<td style="padding-right:25px">
<a href="amazon.com">
<img src="website/gas.jpg" width="75px" height="75px">
</a>
</td>
</tr>
<tr id="pg2" style="display:none">
<td style="padding-left:25px; padding-right:25px">
<a href="google.com">
<img src="website/nuclear.jpg" width="75px" height="75px">
</a>
</td>
<td style="padding-right:25px">
<a href="amazon.com">
<img src="website/solar.jpg" width="75px" height="75px">
</a>
</td>
</tr>
<tr id="pg3" style="display:none">
<td style="padding-left:25px; padding-right:25px">
<a href="google.com">
<img src="website/wind.jpg" width="75px" height="75px">
</a>
</td>
<td style="padding-right:25px">
<a href="amazon.com">
<img src="website/hydro.jpg" width="75px" height="75px">
</a>
</td>
</tr>
<tr id="pg4" style="display:none">
<td style="padding-left:25px; padding-right:25px">
<a href="google.com">
<img src="website/electric.jpg" width="75px" height="75px">
</a>
</td>
<td style="padding-right:25px">
<a href="amazon.com">
<img src="website/thermal.jpg" width="75px" height="75px">
</a>
</td>
</tr>
<tr id="pg5" style="display:none">
<td style="padding-left:25px; padding-right:25px">
<a href="google.com">
<img src="website/mining.jpg" width="75px" height="75px">
</a>
</td>
<td style="padding-right:25px">
<a href="amazon.com">
<img src="website/transversal.jpg" width="75px" height="75px">
</a>
</td>
</tr>
</table>
</body>
</html>