无法使用Javascript重定向到其他页面

无法使用Javascript重定向到其他页面,javascript,asp.net,visual-studio-2010,Javascript,Asp.net,Visual Studio 2010,在html文件中使用Javascript重定向页面,我使用如下方式 window.location.href = "http://www.google.com/"; 工作正常。但是当我尝试使用.aspx时,它不起作用 下面是我的代码。提前谢谢 <head runat="server"> <script type="text/javascript"> function PageRedirect() { window.location.href = "h

在html文件中使用Javascript重定向页面,我使用如下方式

window.location.href = "http://www.google.com/";
工作正常。但是当我尝试使用.aspx时,它不起作用 下面是我的代码。提前谢谢

<head runat="server">
<script type="text/javascript">
   function PageRedirect() {
       window.location.href = "http://www.google.com/";
   }
 </script>
</head>
<body>
<form runat="server">
  <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="PageRedirect()"/>
  </form>

函数PageRedirect(){
window.location.href=”http://www.google.com/";
}
试试这个:

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="PageRedirect(); return false;"/>


它在IE中对我有效,但在chrome中不起作用。在IE和chrome中对我无效,但下面的更改有效谢谢你的有效,我想知道详细信息,你能发送任何有用的参考链接吗:当我不停地返回false时,它的有效,否则不行。想知道为什么提到returnreturn false阻止默认操作。在这种情况下,默认操作是回发到服务器,这在函数中是预防的Yes,我们也可以返回false