要求当用户点击下拉列表之外的空白处时,重新刷新页面。
页面大致布局是:外面一个DIV,里面是一个LISTBOX。当单击LISTBOX外,DIV以内的范围时,刷新页面。刷新页面时,会用此代码:
<script>window.location.reload();</script>;这样实现了一下,发现点击LISTBOX倒是会刷新。
不知应该怎样写?
注:ASP.NET没有CLICK事件。
JScript code<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function test()
{
window.location.reload();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div onclick="test()">
<table onclick="javascript:void(0);">
<tr>
<td>
<asp:ListBox ID="ListBox1" runat="server" Width="190px" ></asp:ListBox>
</td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>
页面大致布局是:外面一个DIV,里面是一个LISTBOX。当单击LISTBOX外,DIV以内的范围时,刷新页面。刷新页面时,会用此代码:
<script>window.location.reload();</script>;这样实现了一下,发现点击LISTBOX倒是会刷新。
不知应该怎样写?
注:ASP.NET没有CLICK事件。
JScript code<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function test()
{
window.location.reload();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div onclick="test()">
<table onclick="javascript:void(0);">
<tr>
<td>
<asp:ListBox ID="ListBox1" runat="server" Width="190px" ></asp:ListBox>
</td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>
你现在是div大小和listbox大小是一样的 ,点击listbox就相当于点击了div了
event.x ,event.y:然后判断区域 在执行刷新