Javascript 对象的位置不是函数

Javascript 对象的位置不是函数,javascript,html,Javascript,Html,我正在尝试使用此功能转到另一个页面 function MButton1Click(event) { alert("teste2"); window.location("teste.php"); } 但是我越来越 对象的位置不是函数 使用以下命令: window.location = "teste.php"; 您的语法用于函数location()但是location是一个对象 看看是一个对象。您可以使用其或功能更改页面: // Use this if you want the back but

我正在尝试使用此功能转到另一个页面

function MButton1Click(event) {
alert("teste2");
window.location("teste.php");
}
但是我越来越

对象的位置不是函数

使用以下命令:

window.location = "teste.php";
您的语法用于函数
location()
但是
location
是一个对象

看看

是一个对象。您可以使用其或功能更改页面:

// Use this if you want the back button to take you to the current page
window.location.assign("teste.php");

// Use this if you want to remove the current page from the browser's history
window.location.replace("teste.php");
您还可以使用for
分配

window.location = "teste.php";

嗯,错误似乎很明显。当它不是函数时,您将其作为函数调用……位置是一个属性。请尝试window.location=”http://...“在您的代码到达此语句之前,可能有其他东西正在破坏您的代码。这是做这件事的方法。查看文档。
函数mbutton1单击(事件){window.location.href=“www.google.com”}
取出
.herf
。我错放了,马上删除了。让我知道它是否成功。