Reputation: 23811
Here is the html code
<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>
The redirect isn't working
Upvotes: 0
Views: 3867
Reputation: 56449
There is no document.location
.
Use either window.location.href
, or location.href
(I prefer the latter :))
Upvotes: 2
Reputation: 145458
Because it should be window.location.href
.
REF: https://developer.mozilla.org/en-US/docs/DOM/window.location
Upvotes: 2