在当前选项卡中从DOM打开页面

时间:2014-05-18 12:22:08

标签: javascript php html dom

在按钮上单击一个PHP函数,我在其中使用Simple HTML DOM Parser中的file_get_html()来编辑html文件中的表单。我想用编辑过的DOM替换当前页面。我尝试以各种方式使用javascript,document.write和window.open,但它将新页面显示到当前页面或没有任何反应。

1 个答案:

答案 0 :(得分:1)

您可以使用javascript

document.body.innerHTML = 'your html';

如果您想更改页面内容,或

location.href = 'some.url';

如果您想在同一页面中打开新网址