这是html代码
<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>
重定向不起作用
最佳答案
没有document.location
。
使用window.location.href
或location.href
(我更喜欢后者:))
关于javascript - url 重定向在 JavaScript 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15131645/