<script type="text/javascript" language="JavaScript">
//折叠效果
var old_menu='';
//var old_cell='';
//var submenu=document.getElementById("submenu1581");
//var cell=document.getElementById("cell1581");
function menuclick(submenu,cell){
if(old_menu!=submenu){
if(old_menu!='')
{
old_menu.style.display='none';
old_cell.src="Img/left.gif";}
submenu.style.display="block";
cell.src='Img/left1.gif';
old_menu=submenu;
old_cell=cell;
}
else
{
submenu.style.display='none';
cell.src='Img/left.gif';
old_menu='';
old_cell='';
}
}
</script>
<td height="30" align="center" class="cartshow">
<font style="cursor:hand; text-decoration:underline; font-weight:700" onclick="menuclick(submenu1581,cell1581)" id="cell1581" color="#0066FF">详细</font>
</td>
</tr>
<tr id="submenu1581" style="display:none;">
<% }
if (isp == 1)
{
p_kxa = basketDt.Rows[i]["kxa"].ToString().Split('/');
p_kxb = basketDt.Rows[i]["kxb"].ToString().Split('/'); %>
<td height="30" align="center" class="cartshow" colspan="7">
<table border="0" cellpadding="5" cellspacing="0" align="right" bgcolor="#eeeeee">
<tr>
<td><b>包含产品</b></td>
<td colspan="2"><b>类型</b></td>
<td width="50"></td>
</tr>
//折叠效果
var old_menu='';
//var old_cell='';
//var submenu=document.getElementById("submenu1581");
//var cell=document.getElementById("cell1581");
function menuclick(submenu,cell){
if(old_menu!=submenu){
if(old_menu!='')
{
old_menu.style.display='none';
old_cell.src="Img/left.gif";}
submenu.style.display="block";
cell.src='Img/left1.gif';
old_menu=submenu;
old_cell=cell;
}
else
{
submenu.style.display='none';
cell.src='Img/left.gif';
old_menu='';
old_cell='';
}
}
</script>
<td height="30" align="center" class="cartshow">
<font style="cursor:hand; text-decoration:underline; font-weight:700" onclick="menuclick(submenu1581,cell1581)" id="cell1581" color="#0066FF">详细</font>
</td>
</tr>
<tr id="submenu1581" style="display:none;">
<% }
if (isp == 1)
{
p_kxa = basketDt.Rows[i]["kxa"].ToString().Split('/');
p_kxb = basketDt.Rows[i]["kxb"].ToString().Split('/'); %>
<td height="30" align="center" class="cartshow" colspan="7">
<table border="0" cellpadding="5" cellspacing="0" align="right" bgcolor="#eeeeee">
<tr>
<td><b>包含产品</b></td>
<td colspan="2"><b>类型</b></td>
<td width="50"></td>
</tr>
这句报错 说 style 为空或不是对象
<script type="text/javascript" language="JavaScript">
var old_menu='';
var old_cell='';
function menuclick(submenu,cellbar){
if(old_menu!=submenu){
if(old_menu!=''){
old_menu.style.display='none';
old_cell.src='../img/left.gif';}
submenu.style.display='block';
cellbar.src='../img/left1.gif';
old_menu=submenu;
old_cell=cellbar;}
else{submenu.style.display='none';
cellbar.src='../img/left.gif';
old_menu='';
old_cell='';}}
</script>
如服务器端你有一个控件id="control1", 执行后到了前台 id="Gridview1$control1"
submenu是JS函数的形参,oldmenu 是申明的变量
具体函数请看 <script type="text/javascript" language="JavaScript">
var old_menu='';
var old_cell='';
function menuclick(submenu,cellbar){
if(old_menu!=submenu){
if(old_menu!=''){
old_menu.style.display='none';
old_cell.src='../img/left.gif';}
submenu.style.display='block';
cellbar.src='../img/left1.gif';
old_menu=submenu;
old_cell=cellbar;}
else{submenu.style.display='none';
cellbar.src='../img/left.gif';
old_menu='';
old_cell='';}}
</script><td height="30" align="center" class="cartshow">
<font style="cursor:hand; text-decoration:underline; font-weight:700" onclick="menuclick(submenu1581,cell1581)" id="cell1581" color="#0066FF">详细 </font>
</td>
</tr>
<tr id="submenu1581" style="display:none;">
//折叠效果
var old_menu='';
//var old_cell='';
//var submenu=document.getElementById("submenu1581");
//var cell=document.getElementById("cell1581");
function menuclick(submenu,cell){
if(old_menu != submenu)
{
if(old_menu != '')
{
old_menu.style.display='none';
old_cell.src="Img/left.gif";
}
submenu.style.display="block";
cell.src='Img/left1.gif';
old_menu = submenu;
old_cell = cell;
}
else
{
submenu.style.display='none';
cell.src='Img/left.gif';
old_menu='';
old_cell='';
}
}
</script>
<table>
<tr>
<td height="30" align="center" class="cartshow">
<font style="cursor:hand; text-decoration:underline; font-weight:700" onclick="menuclick(submenu1581,cell1581)" id="cell1581" color="#0066FF">详细 </font>
</td>
</tr>
<tr id="submenu1581" style="display:none;" >
<td>dsafsdf</td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" align="right" bgcolor="#eeeeee">
<tr>
<td> <b>包含产品 </b> </td>
<td colspan="2"> <b>类型 </b> </td>
<td width="50"> </td>
</tr>
</table>
<td height="30" align="center" class="cartshow" style="width: 131px">
<% if (isp == 0){ %>
<a target="_blank" href="views.aspx?hw_id=<%=basketDt.Rows[i]["hw_id"].ToString()%>"><%=basketDt.Rows[i]["hw_sn"].ToString()%></a>
<% }if (isp == 1){ %>
<a target="_blank" href="page.aspx?p_id=<%=basketDt.Rows[i]["hw_id"].ToString()%>"><%=basketDt.Rows[i]["hw_sn"].ToString()%> </a>
<% } %>
</td>
<td height="30" align="center" class="cartshow">
<% if (isp == 0){ %>
<a target="_blank" href="views.aspx?hw_id=<%=basketDt.Rows[i]["hw_id"].ToString()%>"><%=basketDt.Rows[i]["hw_name"].ToString()%></a>
<% }if (isp == 1){ %>
<a target="_blank" href="page.aspx?p_id=<%=basketDt.Rows[i]["hw_id"].ToString()%>"><%=basketDt.Rows[i]["hw_name"].ToString()%> </a>
<% } %>
</td>
<td height="30" align="center" class="cartshow">¥<%=price%></td>
<td height="30" align="center" class="cartshow"><%=count%></td>
<td height="30" align="center" class="cartshow">¥<%=(price * count).ToString()%></td>
<td height="30" align="center" class="cartshow">
<% if (isp == 0){ %><%=basketDt.Rows[i]["kxb"].ToString() + "-" + basketDt.Rows[i]["kxa"].ToString()%><% // }else{ %>
<font style="cursor:hand; text-decoration:underline; font-weight:700" onclick="menuclick(submenu1581,cell1581)" id="cell1581" color="#0066FF">详细</font>
</td>
<% } %>
</tr>
<tr id="submenu1581" style="display:none;">
<% //if (isp == 0){
// p_kxa = basketDt.Rows[i]["kxa"].ToString().Split('/');
// p_kxb = basketDt.Rows[i]["kxb"].ToString().Split('/'); %>
<td height="30" align="center" class="cartshow" colspan="7">
<table border="0" cellpadding="5" cellspacing="0" align="right" bgcolor="#eeeeee">
<tr>
<td><b>包含产品</b></td>
<td colspan="2"><b>类型</b></td>
<td width="50"></td>
</tr>
<% string queryP = "select * from venshop_p where p_id=" + int.Parse(basketDt.Rows[i]["hw_id"].ToString());
pDt = Help.ReturnDataTable(Help.ConnectionDataBase, queryP);
//if (pDt.Rows.Count > 0)
//{
// hwIDItems = pDt.Rows[0]["p_pro"].ToString().Split('/');
// for (int j = 1; j < hwIDItems.Length - 1; j++)
// {
// string queryHw = "select * from venshop_hw where hw_id=" + hwIDItems[j];
// hwDt = Help.ReturnDataTable(Help.ConnectionDataBase, queryHw);
// if (hwDt.Rows.Count > 0)
// {
%>
<tr><%--
<td><a target="_blank" href="views.aspx?hw_id=<%=hwDt.Rows[0]["hw_id"].ToString()%>"><%=hwDt.Rows[0]["hw_name"].ToString()%></a></td>--%>
<td><%--<%=hwDt.Rows[0]["kxab"].ToString() + "-" + hwDt.Rows[0]["kxbb"].ToString()%> --%></td>
<td></td>
<td width="50"></td>
</tr></table>
</td>
</tr>
<% // } } } }
} %>
var ul=document.getElementsByTagName("ul"); var allcontrol = document.all[0];
var rowvalue = allcontrol.getElementsByTagName('input');
for (i = 0; i < rowvalue.length; i++) {
if(rowvalue[i].type=='checkbox'&&rowvalue[i].id=='check'){
if(rowvalue[i].checked)
rowvalue[i].value="1";
else
rowvalue[i].value="-1";
}
}
if(document.form1.signalid.options[document.form1.signalid.selectedIndex].value==""){
alert("请选择内容!");
}else{
if(Validator.Validate(formobj,validatetype)){
if(vaction){
formobj.action=vaction;
}
formobj.submit();
formobj.reset();
}
}
}
var submenu=document.getElementById("submenu1581");
var cell=document.getElementById("cell1581"); menuclick参数不传,这样可以正常执行吗
var old_menu='';
var old_cell=''
function menuclick(){
var submenu =document.getElementById("submenu1581");
var cell=document.getElementById("cell1581");
if(old_menu!=submenu){
if(old_menu!='')
{
old_menu.style.display='none';
old_cell.src="Img/left.gif";}
submenu.style.display="block";
cell.src='Img/left1.gif';
old_menu=submenu;
old_cell=cell;
}
else
{
submenu.style.display='none';
cell.src='Img/left.gif';
old_menu='';
old_cell='';
}
}
谢谢各位兄弟姐妹的解答