2013-02-28 111 views
0

工作下面是HTML代碼URL重定向沒有在JavaScript

<head runat="server"> 
<title>Untitled Page</title> 

<script type="text/javascript"> 
    function func() 
    { 
     document.location.href="www.google.com" 
    } 
</script> 

</head> 
<body> 
    <form id="form1" runat="server"> 
    <input type="button" runat="server" onclick="func();" /> 
    </form> 
</body> 
</html> 

重定向不工作

回答

2

沒有document.location

使用要麼window.location.href,或location.href(我更喜歡後者:))