积极答复者
js点击展开 一级标题怎么消失了

问题
-
js点击展开 一级标题怎么消失了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>无标题页</title> <script type="text/javascript"> function showsubmenu(obj,sid) { var whichEl = eval("submenu" + sid); if (whichEl.style.display=="none") { obj.innerHTML="-"; eval("submenu" + sid + ".style.display=\"\";"); } else { obj.innerHTML="+"; eval("submenu" + sid + ".style.display=\"none\";"); } } </script> </head> <body> <div> <table width="175" align="center" cellpadding="0" cellspacing="0" style="height: 10" bgcolor="white"> <tbody> <span id="Label1"> <tr> <td id='imgmenu1' class='l_th' onclick='showsubmenu(this,1)' style='cursor:hand' align='center'><span id='1'>+</span>刀具</td> </tr> <tr> <td ><div class='sec_menu' id="submenu1" style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-手术刀</a></td> </tr> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-剪刀</a></td> </tr> </table> </div></td> </tr> <tr> <td id='imgmenu1' class='l_th' onclick='showsubmenu(this,2)' style='cursor:hand' align='center'><span id='2'>+</span>电视</td> </tr> <tr> <td ><div class='sec_menu' id='submenu2' style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-黑白电视</a></td> </tr> </table> </div></td> </tr> </span> </tbody> </table> </div> </form> </body> </html>- 已编辑 极度 2009年7月9日 15:18
- 已移动 Sheng Jiang 蒋晟 2009年7月9日 18:07 客户端脚本问题 (发件人:ASP.NET 与 AJAX)
答案
-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>无标题页</title> <script type="text/javascript"> function showsubmenu(obj, sid) { var fElementId = "submenu" + sid; var fElement = document.getElementById(fElementId); if (fElement.style.display == "none") { obj.innerHTML = "-"; fElement.style.display = ""; } else { obj.innerHTML = "+"; fElement.style.display = "none"; } } </script> </head> <body> <div> <table width="175" align="center" cellpadding="0" cellspacing="0" style="height: 10" bgcolor="white"> <tbody> <span id="Label1"> <tr> <td id='imgmenu1' class='l_th' onclick='showsubmenu(this,1)' style='cursor:hand' align='center'><span id='1'>+</span>刀具</td> </tr> <tr> <td ><div class='sec_menu' id="submenu1" style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-手术刀</a></td> </tr> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-剪刀</a></td> </tr> </table> </div></td> </tr> <tr> <td id='imgmenu2' class='1_th' onclick='showsubmenu(this,2)' style='cursor:hand' align='center'><span id='2'>+</span>电视</td> </tr> <tr> <td ><div class='sec_menu' id='submenu2' style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-黑白电视</a></td> </tr> </table> </div></td> </tr> </span> </tbody> </table> </div> </form> </body> </html>
知识改变命运,奋斗成就人生!- 已标记为答案 极度 2009年7月10日 7:59
全部回复
-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>无标题页</title> <script type="text/javascript"> function showsubmenu(obj, sid) { var fElementId = "submenu" + sid; var fElement = document.getElementById(fElementId); if (fElement.style.display == "none") { obj.innerHTML = "-"; fElement.style.display = ""; } else { obj.innerHTML = "+"; fElement.style.display = "none"; } } </script> </head> <body> <div> <table width="175" align="center" cellpadding="0" cellspacing="0" style="height: 10" bgcolor="white"> <tbody> <span id="Label1"> <tr> <td id='imgmenu1' class='l_th' onclick='showsubmenu(this,1)' style='cursor:hand' align='center'><span id='1'>+</span>刀具</td> </tr> <tr> <td ><div class='sec_menu' id="submenu1" style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-手术刀</a></td> </tr> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-剪刀</a></td> </tr> </table> </div></td> </tr> <tr> <td id='imgmenu2' class='1_th' onclick='showsubmenu(this,2)' style='cursor:hand' align='center'><span id='2'>+</span>电视</td> </tr> <tr> <td ><div class='sec_menu' id='submenu2' style="display:none"> <table cellspacing='0' cellpadding='0' width='140' align='center' border='0'> <tr> <td height='20' align='left'><a class='l_td' target='MainIFrame' href='#'>-黑白电视</a></td> </tr> </table> </div></td> </tr> </span> </tbody> </table> </div> </form> </body> </html>
知识改变命运,奋斗成就人生!- 已标记为答案 极度 2009年7月10日 7:59