gpt4 book ai didi

javascript - 如何使用 jquery 使整个菜单栏元素+区域可点击

转载 作者:太空宇宙 更新时间:2023-11-04 13:45:45 25 4
gpt4 key购买 nike

我有一个菜单栏。我刚刚发现了一些有用的东西,使整个菜单栏区域应该可以用 jquery 点击。

这里是设计代码:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MenuControl.ascx.cs" Inherits="MenuControl"%>
<link rel="stylesheet" href="css/Menu3.css" type="text/css" />
<div id="header" align="center" >
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".Menu").click(function(e) {
window.location = $(e.target).find("a").attr("href");
return false;
});
});
</script>
<table width="100%" cellpadding ="0" cellspacing ="0" align="center">
<tr>
<td align="center">
<asp:Menu ID="Menu1" runat="server" Orientation ="Horizontal" CssClass="Menu"
ForeColor ="Black" Width="100%" ScrollDownText=""
StaticPopOutImageUrl="~/images/down_arrow_1.gif">
<StaticMenuItemStyle Height="40px"/>
<DynamicMenuItemStyle Height="40px" CssClass="Menu" HorizontalPadding="10px"/>
<StaticHoverStyle CssClass="menuhover" />
<DynamicHoverStyle CssClass="menuhover" />
</asp:Menu>
</td>
</tr>
</table>
</div>

当我单击菜单项的区域时如何工作正常但是当我单击原始菜单项时会发生如下错误:

Server Error in '/EasyWeb' Application.
--------------------------------------------------------------------------------

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /EasyWeb/undefined


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

我的 jquery 代码有问题吗??

------------------------------------已更新------ ----------------------------------

这里是 html 完整标记:

<table width="100%" cellpadding ="0" cellspacing ="0" align="center">
<tr>
<td align="center">
<a href="#menu1_Menu1_SkipLink"><img alt="Skip Navigation Links" src="/EasyWeb/WebResource.axd?d=uS7YYfXnUXiSaHkS-NobyQ2&amp;t=635234834251287338" width="0" height="0" style="border-width:0px;" /></a><table id="menu1_Menu1" class="Menu menu1_Menu1_2" cellpadding="0" cellspacing="0" border="0">
<tr>
<td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n0"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="Default.aspx">Home</a></td>
</tr>
</table></td><td style="width:3px;"></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n1"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="Register.aspx">Sign Up</a></td>
</tr>
</table></td><td style="width:3px;"></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n2"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="javascript:__doPostBack('menu1$Menu1','Services')">Services</a></td><td style="width:0;"><img src="images/down_arrow_1.gif" alt="Expand Services" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n3"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="javascript:__doPostBack('menu1$Menu1','Tools')">Tools</a></td><td style="width:0;"><img src="images/down_arrow_1.gif" alt="Expand Tools" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n4"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="javascript:__doPostBack('menu1$Menu1','Important Links')">Important Links</a></td><td style="width:0;"><img src="images/down_arrow_1.gif" alt="Expand Important Links" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n5"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="javascript:__doPostBack('menu1$Menu1','Acts')">Acts</a></td><td style="width:0;"><img src="images/down_arrow_1.gif" alt="Expand Acts" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n6"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="javascript:__doPostBack('menu1$Menu1','Rules')">Rules</a></td><td style="width:0;"><img src="images/down_arrow_1.gif" alt="Expand Rules" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n7"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="http://law.incometaxindia.gov.in/DIT/Circulars.aspx">Circulars</a></td>
</tr>
</table></td><td style="width:3px;"></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n8"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="http://law.incometaxindia.gov.in/DIT/Notifications.aspx">Notification</a></td>
</tr>
</table></td><td style="width:3px;"></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n9"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="http://www.incometaxindia.gov.in/allforms.asp">Forms</a></td>
</tr>
</table></td><td style="width:3px;"></td><td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n10"><table class="menu1_Menu1_4" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="menu1_Menu1_1 menu1_Menu1_3" href="http://easyweb999.wordpress.com/">Blog</a></td>
</tr>
</table></td>
</tr>
</table><div id="menu1_Menu1n2Items" class="menu1_Menu1_0">
<table border="0" cellpadding="0" cellspacing="0">
<tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n11">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Corporate Services')" style="border-style:none;font-size:1em;">Corporate Services</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n12">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Corporate Finance')" style="border-style:none;font-size:1em;">Corporate Finance</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n13">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Corporate Finance')" style="border-style:none;font-size:1em;">Corporate Finance</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n14">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Accounting Services')" style="border-style:none;font-size:1em;">Accounting Services</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n15">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Payroll')" style="border-style:none;font-size:1em;">Payroll</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n16">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Benefits of Outsourcing')" style="border-style:none;font-size:1em;">Benefits of Outsourcing</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n17">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Income Tax')" style="border-style:none;font-size:1em;">Income Tax</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n18">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Value Added Tax (VAT)')" style="border-style:none;font-size:1em;">Value Added Tax (VAT)</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n19">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\Service Tax')" style="border-style:none;font-size:1em;">Service Tax</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n20">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Services\\TDS/FBT')" style="border-style:none;font-size:1em;">TDS/FBT</a></td>
</tr>
</table></td>
</tr>
</table><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n2ItemsUp" onmouseover="PopOut_Up(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=WOcqFGSOX-4KCNzzZKFmZljtQUM9O7kD3Xq3fcz3ZVY1&amp;t=635234834251287338" alt="Scroll up" />
</div><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n2ItemsDn" onmouseover="PopOut_Down(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=-r2DsOX_bJ0J6gpZu3I-GAcZkKhJPqAevVJdTAHh6E01&amp;t=635234834251287338" alt="" />
</div>
</div><div id="menu1_Menu1n3Items" class="menu1_Menu1_0">
<table border="0" cellpadding="0" cellspacing="0">
<tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n21">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Tools\\TDS Rates for N.R.I u/s 195')" style="border-style:none;font-size:1em;">TDS Rates for N.R.I u/s 195</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n22">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Tools\\Rates of Income Tax')" style="border-style:none;font-size:1em;">Rates of Income Tax</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n23">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Tools\\Rates of NSC Interest')" style="border-style:none;font-size:1em;">Rates of NSC Interest</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n24">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Tools\\ROC Fee Structure')" style="border-style:none;font-size:1em;">ROC Fee Structure</a></td>
</tr>
</table></td>
</tr>
</table><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n3ItemsUp" onmouseover="PopOut_Up(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=WOcqFGSOX-4KCNzzZKFmZljtQUM9O7kD3Xq3fcz3ZVY1&amp;t=635234834251287338" alt="Scroll up" />
</div><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n3ItemsDn" onmouseover="PopOut_Down(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=-r2DsOX_bJ0J6gpZu3I-GAcZkKhJPqAevVJdTAHh6E01&amp;t=635234834251287338" alt="" />
</div>
</div><div id="menu1_Menu1n4Items" class="menu1_Menu1_0">
<table border="0" cellpadding="0" cellspacing="0">
<tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n25">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\PAN')" style="border-style:none;font-size:1em;">PAN</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand PAN" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n26">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\TAN')" style="border-style:none;font-size:1em;">TAN</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand TAN" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n27">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\E-Payment Online')" style="border-style:none;font-size:1em;">E-Payment Online</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand E-Payment Online" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n28">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\IncomeTax')" style="border-style:none;font-size:1em;">IncomeTax</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand IncomeTax" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n29">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\CBEC')" style="border-style:none;font-size:1em;">CBEC</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand CBEC" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n30">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\PF &amp; ESI')" style="border-style:none;font-size:1em;">PF & ESI</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand PF &amp; ESI" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n31">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\Excise and Service Tax')" style="border-style:none;font-size:1em;">Excise and Service Tax</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand Excise and Service Tax" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n32">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\MCA')" style="border-style:none;font-size:1em;">MCA</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand MCA" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n33">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\VAT')" style="border-style:none;font-size:1em;">VAT</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n34">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\CA/CS/CWA')" style="border-style:none;font-size:1em;">CA/CS/CWA</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand CA/CS/CWA" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n35">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\CIBIL')" style="border-style:none;font-size:1em;">CIBIL</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand CIBIL" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n36">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\IEPF')" style="border-style:none;font-size:1em;">IEPF</a></td><td style="width:0;"><img src="/EasyWeb/WebResource.axd?d=h5TZ_gXVB1RnNj7NTVeAgYjX6yi42JGwgXdtAbGcijc1&amp;t=635234834251287338" alt="Expand IEPF" style="border-style:none;vertical-align:middle;" /></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n37">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="javascript:__doPostBack('menu1$Menu1','Important Links\\RTI')" style="border-style:none;font-size:1em;">RTI</a></td>
</tr>
</table></td>
</tr>
</table><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n4ItemsUp" onmouseover="PopOut_Up(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=WOcqFGSOX-4KCNzzZKFmZljtQUM9O7kD3Xq3fcz3ZVY1&amp;t=635234834251287338" alt="Scroll up" />
</div><div class="Menu menu1_Menu1_6 menu1_Menu1_0" id="menu1_Menu1n4ItemsDn" onmouseover="PopOut_Down(this)" onmouseout="PopOut_Stop(this)" style="text-align:center;">
<img src="/EasyWeb/WebResource.axd?d=-r2DsOX_bJ0J6gpZu3I-GAcZkKhJPqAevVJdTAHh6E01&amp;t=635234834251287338" alt="" />
</div>
</div><div id="menu1_Menu1n25Items" class="menu1_Menu1_0">
<table border="0" cellpadding="0" cellspacing="0">
<tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n38">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="https://incometaxindiaefiling.gov.in/e-Filing/Services/KnowYourPanLink.html" target="_blank" style="border-style:none;font-size:1em;">Know Your PAN</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n39">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="https://tin.tin.nsdl.com/tan/StatusTrack.html" target="_blank" style="border-style:none;font-size:1em;">Status Of Pan NSDL</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n40">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="http://www.myutiitsl.com/PANONLINE/panTracker.do" target="_blank" style="border-style:none;font-size:1em;">Status Of Pan UTIITSL</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n41">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="https://tin.tin.nsdl.com/pan/index.html" target="_blank" style="border-style:none;font-size:1em;">Apply Online Pan NSDL</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n42">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="http://www.utiitsl.com/" target="_blank" style="border-style:none;font-size:1em;">Apply Online Pan UTIITSL</a></td>
</tr>
</table></td>
</tr><tr onmouseover="Menu_HoverDynamic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="menu1_Menu1n43">
<td><table class="Menu menu1_Menu1_6" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;width:100%;"><a class="menu1_Menu1_1 Menu menu1_Menu1_5" href="http://law.incometaxindia.gov.in/DITTaxmann/IncomeTaxRules/pdf/Form49aE.PDF" target="_blank" style="border-style:none;font-size:1em;">Form Apply For PAN</a></td>
</tr>
</table>

…………

最佳答案

你的问题在这里:

window.location = $(e.target).find("a").attr("href");

当您单击 a 元素时,e.target 将成为 a 元素本身,因此...

$(e.target).find('a');

返回一个空的 jQuery 对象,因为 e.target 没有子元素。如果您想使用 e.target,您需要这样做:

var $a = e.target.nodeName.toLowerCase() == 'a' ? $(e.target) : $(e.target).find('a');
window.location = $a.attr('href');

这样您就可以检查您是否已经点击了 a 元素。如果是,则使用它;如果没有,搜索它。

关于javascript - 如何使用 jquery 使整个菜单栏元素+区域可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22531321/

25 4 0