|
高手帮忙看看这段代码,要实现的功能:我想每次打开asp页面,显示的都是上次退出时的温度图片(这个已经实现),并且调节温度也是从这个退出时的温度为参考点开始的。
现在的问题是:我可以将下面的i值设置对应成arrImg中的任何一个,比如说i=8,即对应25度,则每次调节温度的时候它都是从25度开始变化的,如何改成从我上次退出时的那个温度开始变化?我用CGI输出了一个hidden,对应的value值即为服务器端当前的温度(document.control.tempshow.value),我把它付给i,图片不能正常显示,调节后图片出不来。按道理说应该可以啊!请高手出马,指点下。
<script language="javascript">
var arrImg=new Array("17.jpg","18.jpg","19.jpg","20.jpg","21.jpg","22.jpg","23.jpg","24.jpg","25.jpg","26.jpg",
"27.jpg","28.jpg","29.jpg","30.jpg","temp.jpg");
var i=8;
var pic=1;
document.getElementById("imgFld").src=arrImg[i];
document.getElementById("imgFld").attachEvent(onclick,function(){window.open(document.getElementById("imgFld").src);});
function prevImg() {
if(i==0) return;
i--;
document.getElementById("imgFld").src=arrImg[i];
pic--;
whichpic.innerHTML =pic;
submitform(i);
}
function nextImg() {
if(i==arrImg.length-2) return;
i++;
pic++;
document.getElementById("imgFld").src=arrImg[i];
whichpic.innerHTML =pic;
submitform(i);
}
function submitform(dir)
{
dir=dir.toString();
document.control.dir.value=dir;
document.control.presetenable.value='0';
document.control.submit();
}
</script>
form method="get" action="/cgi/ptzcontrol" name="control" target="_self">
<tbody>
<tr>
<td colspan="3" align="center" valign="middle" bgcolor="#ECA12E"><img src="head.jpg" width="222" height="83"></td>
</tr>
<tr>
<td width="56" align="center" valign="middle"><div align="right"><font style="font-size: 15px" color="#000000">
<% aspModeControll(1); %>
</font></div></td>
<td width="103" align="center" valign="middle"><div align="center"><font style="font-size: 15px" color="#000000">
<% aspTempShow(1); %>
</font></div></td>
<td width="58" align="center" valign="middle"><div align="left"><font style="font-size: 15px" color="#000000">
<% aspWindSpeedControll(1); %>
</font></div></td>
</tr>
<tr>
<td colspan="3" align="center" valign="middle" bgcolor="#ECA12E"><img src="foot.jpg" width="222" height="375" border="0" usemap="#FPMap0Map">
<map name="FPMap0Map">
<area href="javascript:submitform('offtime')" shape="rect" coords="152,174,182,196">
<area href="javascript:submitform('ontime')" shape="rect" coords="37,176,67,198">
<area href="javascript:submitform('sleep')" shape="rect" coords="154,135,184,157">
<area href="javascript:submitform('flushwind')" shape="rect" coords="37,135,67,157">
<area href="javascript:submitform('windspeed');windspeedselect()" shape="rect" coords="154,97,184,119">
<area href="javascript:submitform('setmode');modeselect()" shape="rect" coords="37,95,67,117">
<area href="javascript:submitform('onoff')" shape="rect" coords="78,90,142,119">
<area href="javascript:submitform('addtemp');nextImg()" shape="rect" coords="121,36,181,58">
<area shape="rect" coords="40,36,100,58" href="javascript:submitform('minustemp');prevImg()" target="_blank">
</map></td>
</tr>
<input type="hidden" name="dir" value=""><input type="hidden" name="presetenable" value="1"><input type="hidden" name="preset">
<% aspTransTemp(1); %>
</form>
<tr><td colspan="3"></tbody>
</table>
</body>
</html> |
|