【发布时间】:2017-03-01 17:42:33
【问题描述】:
我想使用 Javascript 或 PHP 清除网页。
但是,我相信页面的一个区域是: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/ (然后点击提交按钮)。在“建议”部分之后,我希望它将用户重定向到网站的主页。
【问题讨论】:
-
谢谢你。我的主要目标是将用户重定向到新页面。我希望那个新页面填满>整个
-
@Andrea 你看到我的回答了吗?如果您有任何问题,请告诉我。
标签: javascript php redirect iframe