我有以下代码:
<span style="margin:0px 2px 0px 2px;">
<asp:Label ID="labelPromptText" runat="server" Text="Selected Location:" />
<span id="spanSelectedLocation" style="padding:2px 2px 2px 2px; cursor:pointer;" onmouseover="javascript:SetBackgroundColor('spanSelectedLocation', '#E0E0E0');" onmouseout="javascript:SetBackgroundColor('spanSelectedLocation', '#FFFFFF');" onclick="ControlLocationsVisibility();">
<asp:Label ID="labelDisplay" runat="server" Text="None" Font-Bold="True" />
<img alt="Click to change" src="Images/downArrow.png" />
</span>
</span>
<asp:Panel ID="panelLocations" runat="server" DefaultButton="buttonFindLocation" style="position:absolute;border:solid 1px #E0E0E0;padding:10px 5px 5px 10px;background-color:#F7F7F7;width:350px;display:none;" >
Search: <asp:TextBox ID="textboxLocationSearch" runat="server" />
<asp:Button ID="buttonFindLocation" runat="server" Text="Find" OnClick="buttonFindLocation_Click" />
<input type="button" value="Cancel" onclick="javascript:ControlLocationsVisibility();"
<hr />
<asp:TreeView ID="TreeViewLocations" runat="server" OnSelectedNodeChanged="TreeViewLocations_SelectedNodeChanged" NodeIndent="10"></asp:TreeView>
</asp:Panel>
当有人点击面板时,我希望能够隐藏 panelLocations。我尝试放置 panelLocations 的 onblur 事件,但单击 TreeView 时它总是消失。
当有人在面板外部单击而不是在面板内部单击时,如何隐藏面板?