<SCRIPT LANGUAGE="JavaScript">
<!--
function show(tabid,imgid)
{
var img = document.getElementById(imgid);
var tab = document.getElementById(tabid);
if(tab && img)
{
var b = tabid.style.display=="none";
img.src = b ? '../Common/images/arrow_hide.gif' : '../Common/images/arrow_show.gif';
tab.style.display = b ? "block" : "none";
}
}
//-->
</SCRIPT>onclick="javascript:show('table_index', 'ImageButton11')"
onclick="javascript:show('table_line', 'ImageButton10')"
<!--
function show(tabid,imgid)
{
var img = document.getElementById(imgid);
var tab = document.getElementById(tabid);
if(tab && img)
{
var b = tabid.style.display=="none";
img.src = b ? '../Common/images/arrow_hide.gif' : '../Common/images/arrow_show.gif';
tab.style.display = b ? "block" : "none";
}
}
//-->
</SCRIPT>onclick="javascript:show('table_index', 'ImageButton11')"
onclick="javascript:show('table_line', 'ImageButton10')"
<table id="table_liebiao" style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839"
border="0" runat="server">
<tr>
<td align="left" colSpan="4" height="5"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td align="left" width="9%"><FONT face="宋体"> <asp:label id="Label1" runat="server">参数列表</asp:label></FONT></td>
<td width="30%"><FONT face="宋体"><asp:label id="Label_Starttime" runat="server" Visible="False">启用时间</asp:label><asp:textbox id="TB_Starttime" onfocus="dateTimeBox()" runat="server" Width="144px" Visible="False"
BackColor="White" BorderColor="#89D7FE"></asp:textbox></FONT></td>
<td width="50%"><FONT face="宋体"></FONT></td>
<td align="right" width="11%"><IMG id="ImageButton11" onclick="javascript:show('table_index','ImageButton11')" src="../Common/images/arrow_hide.gif" height="21"></td>
</tr>
</table>
<table>
<tr>
<td vAlign="top" width="100%" colSpan="4">
<table id="table_index" style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839"
border="0" runat="server">
<tr>
<td vAlign="top" align="left" width="100%" colSpan="2">
<div style="WIDTH: 869px"><asp:table id="Table_Head" runat="server" Width="93%"></asp:table></div>
<FONT face="宋体"></FONT>
</td>
</tr>
<tr>
<td vAlign="top" align="left" width="100%" colSpan="2">
<div style="OVERFLOW: auto; WIDTH: 869px; HEIGHT: 300px"><asp:table id="Table_Main" runat="server" Width="95%"></asp:table></div>
</td>
</tr>
<tr>
<td align="left" colSpan="2" height="1"><FONT face="宋体"></FONT></td>
</tr>
</table>
<FONT face="宋体"></FONT>
</td>
</tr>
</table><SCRIPT LANGUAGE="JavaScript">
function show(tabid,imgid)
{
var img = document.getElementById(imgid);
var tab = document.getElementById(tabid);
if(tab && img)
{
var b = tabid.style.display=="none";
img.src = b ? '../Common/images/arrow_hide.gif' : '../Common/images/arrow_show.gif';
tab.style.display = b ? "block" : "none";
}
}
</SCRIPT>
上述代码仅以ImageButton11为例
应该这样var b = tab.style.display=="none";
报错的地方代码如下:
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td bgColor="#89d7fe" height="1"><FONT face="宋体"></FONT></td>
</tr>
</table>
<table style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839" border="0">
<tr>
<td align="left" colSpan="4" height="5"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td style="HEIGHT: 5px" align="left" width="9%"><FONT face="宋体"> <asp:label id="Label_Line" runat="server">工艺路线</asp:label></FONT></td>
<td style="HEIGHT: 5px" width="30%"><asp:dropdownlist id="DDL_Line" runat="server" Width="100%" AutoPostBack="True"></asp:dropdownlist></td>
<td style="HEIGHT: 5px" width="50%"><FONT face="宋体"></FONT></td>
<td style="HEIGHT: 5px" align="right" width="11%"><IMG id="ImageButton10" onclick="javascript:show(table_line,ImageButton10)" src="../Common/images/arrow_hide.gif"
height="21"></td>
</tr>
<tr>
<td align="left" colSpan="4" height="1"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<table>
<tr>
<td>
<table id="table_line" style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839"
border="0" runat="server">
<tr>
<td align="left" colSpan="2" height="1"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td vAlign="top" align="left" width="9%"><FONT face="宋体"> <asp:label id="Label_LineCompose" runat="server">路线组成</asp:label></FONT></td>
<td vAlign="top" align="left" width="91%" height="150"><FONT face="宋体"><iewc:treeview id="RTV_ProcCompose" runat="server" height="150" width="99.5%"></iewc:treeview></FONT></td>
</tr>
<tr>
<td align="left" colSpan="2" height="1"><FONT face="宋体"></FONT></td>
</tr>
</table>
</td>
</tr>
</table>可以正确使用的代码如下:
<table id="table_liebiao" style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839"
border="0" runat="server">
<tr>
<td align="left" colSpan="4" height="5"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td align="left" width="9%"><FONT face="宋体"> <asp:label id="Label1" runat="server">参数列表</asp:label></FONT></td>
<td width="30%"><FONT face="宋体"><asp:label id="Label_Starttime" runat="server" Visible="False">启用时间</asp:label><asp:textbox id="TB_Starttime" onfocus="dateTimeBox()" runat="server" Width="144px" Visible="False"
BackColor="White" BorderColor="#89D7FE"></asp:textbox></FONT></td>
<td width="50%"><FONT face="宋体"></FONT></td>
<td align="right" width="11%"><IMG id="ImageButton11" onclick="javascript:show(table_index,ImageButton11)" src="../Common/images/arrow_hide.gif"
height="21"></td>
</tr>
</table>
<table>
<tr>
<td vAlign="top" width="100%" colSpan="4">
<table id="table_index" style="WIDTH: 839px" cellSpacing="0" cellPadding="0" width="839"
border="0" runat="server">
<tr>
<td vAlign="top" align="left" width="100%" colSpan="2">
<div style="WIDTH: 869px"><asp:table id="Table_Head" runat="server" Width="93%"></asp:table></div>
<FONT face="宋体"></FONT>
</td>
</tr>
<tr>
<td vAlign="top" align="left" width="100%" colSpan="2">
<div style="OVERFLOW: auto; WIDTH: 869px; HEIGHT: 300px"><asp:table id="Table_Main" runat="server" Width="95%"></asp:table></div>
</td>
</tr>
<tr>
<td align="left" colSpan="2" height="1"><FONT face="宋体"></FONT></td>
</tr>
</table>
<FONT face="宋体"></FONT>
</td>
</tr>
</table>调用的函数如下:
<SCRIPT language="javascript">
function show(tabid,imgid){
if(tabid.style.display!='none')
{
imgid.src='../Common/images/arrow_show.gif';
tabid.style.display='none';
}
else
{
imgid.src='../Common/images/arrow_hide.gif';
tabid.style.display='block';
}
}
</SCRIPT>