日期:2014-05-16  浏览次数:20426 次

100分求助C#加javascript做动态菜单问题
我做的这个菜单无法拉下和收起,数据都能显示出来的。请哪位大人帮我看看,谢谢了

代码如下:
//javascript--显示和隐藏下拉框的代码
string   st= " <script   language= 'javascript '> ";  
st+= " ' <!--   ' ";
st+= "var   old_menu   =   ' '; ";
st+= "var   old_cell   =   ' '; ";  
st+= "function   menuclick(   submenu   ,cellbar) ";  
st+= "{   if(   old_menu   !=   submenu   ){   if(   old_menu   != ' '   ){   old_menu.style.display   =   'none ';   old_cell.src=   'plus.gif ';   }   ";
st+= "submenu.style.display   =   'block ';   cellbar.src   =   'plus.gif ';   old_menu   =   submenu;   old_cell   =   cellbar;   } ";
st+= "else{   submenu.style.display   =   'none ';   cellbar.src=   'plus.gif ';   old_menu   =   ' ';   old_cell   =   ' ';   } ";  
st+= "}   ' ";
st+= "//--> ";

//这里是对数据进行读取
st= " <tabel     borderColor= 'lightskyblue '   cellSpacing= '0 '   cellPadding= '0 '   width= '100 '   border= '1 'align= 'center '> ";
string   str= "select   distinct(class)   from   club_class ";
DataSet   ds=SqlDB.GetDataSet(str);


for(int   i=0;i <ds.Tables[0].Rows.Count;i++)
{
if(ds.Tables[0].Rows[i][0].ToString()!= " ")
{
string   str1= "select   top   5   title   from   club_main   where   class= ' "+ds.Tables[0].Rows[i][0].ToString()+ " ' ";
DataSet   ds1=SqlDB.GetDataSet(str1);

//主菜单
st+= " <tr> <td   align= 'left '   onclick= 'menuclick(submenu "+i+ ",bar "+i+ "   ); '   style= 'CURSOR:hand '   width= '103 ' ";

st+= "bordercolordark= 'white '   bordercolorlight= 'gray '   onmouseover= 'this.style.backgroundColor= '#FFCCCC ' ";

st+= "onmouseout= 'this.style.backgroundColor= ' ' '   title= '主题列表 '> ";
st+= " <img   src= '../admin/plus.gif '   border= '0 '   id= 'bar "+i+ " '   width= '11 '   height= '11 '> <font   color= '#000000 '> ";
st+= " "+ds.Tables[0].Rows[i][0].ToString()+ " </font> ";

//下拉菜单
st+= " <tr> <td   align= 'left '   width= '143 '> <span   id= 'submenu "+i+ " '   style= 'DISPLAY:block;MARGIN-LEFT:5px '> ";
for(int   j=0;j <ds1.Tables[0].Rows.Count;j++)
{
if(ds1.Tables[0].Rows[j][0].ToString().Length> 12)
{
ds1.Tables[0].Rows[j][0]=ds1.Tables[0].Rows[j][0].ToString().Substring(0,12)+ ".. ";
}
else
{
ds1.Tables[0].Rows[j][0]=ds1.Tables[0].Rows[j][0].ToString();
}
st+= " <img   src= '../user/images/index_point.gif '   border= '0 '   width= '12 '   height= '12 '> "+ds1.Tables[0].Rows[j][0].ToString()+ " <br> &q