我想使用Javascript或PHP清除网页。使用iframes清除网页上的内容
不过,我相信页面的一个区域是:data-form="manual iframe"
所以,当我尝试“清除”页面时,它只会清除该iframe中的数据。其余内容仍然存在。
有谁知道如何清除页面上的所有内容,而不仅仅是iframe中的内容吗?
我的总体目标是清除当前网页中的所有内容,然后将用户重定向到完全不同的网页(主页)。
这里是我到目前为止的代码(在PHP):
// An attempt using javascript (didn't work, only cleared info in iframe)
echo "<script language=\"javascript\">
var body = document.getElementById('body');
body.innerHTML ='';
var divrow1 = document.getElementByClassName('row');
divrow1.innerHTML ='';
</script>
";
// Another attempt using PHP (didn't work only cleared content in iframe)
document.write ("");
//This is where I want page to redirect to:
header("Location: http://www.challengehut.com/index.php");
exit;
如果你想看到整个事情,就从这里开始: 点击这里:http://challengehut.com/TheChallenges/ (然后点击提交按钮)。在“建议”部分之后,我希望它将用户重定向到网站的主页。
参见[如何清除的iFrame的从另一个的iFrame的内容](http://stackoverflow.com/questions/33645685/how-to-clear-the-contents-of-an -iframe-from-another-iframe/33649349?s = 1 | 1.1516#33649349) – guest271314
谢谢。我的主要目标是将用户重定向到新页面。我希望这个新的页面能够填满整个网页(不只是小型的iFrame)。有没有简单的方法来做到这一点? – Andrea
@Andrea你看到我的答案了吗?如果您有任何问题,请告诉我。 –