我使用以下脚本:
<div id="accesso" class="spalla_basic grigio_type clearfix">
<iframe src="test.php" frameborder="0" width="257" height="160" marginheight="0" marginwidth="0" scrolling="no"></iframe>
</div>
在我的主页中,有上面的代码。当我按yes
以上代码块时,它将重定向到新页面。
但是我的问题是:当我单击此块时,它会将我重定向到一个新页面,但包含在此块中。
因此,您基本上希望iframe中的页面在单击按钮后转义框架并加载到其他选项卡中吗?这就是您要完成的工作吗?
尝试将以下代码添加到该<head>
部分。
<script type="text/javascript">
if (top.location!= self.location){
top.location = self.location
}
</script>
以下是带有iframe的HTML文件,该文件加载具有按钮的PHP代码。
<html>
<body>
<iframe src="sample.php">
</body>
</html>
假设Landing.php是单击按钮后重定向到的页面。JavaScript代码应合并在landing.php中
<?php
echo "<html>
<head>
<script type="text/javascript">
if (top.location!= self.location){
top.location = self.location
}
</script>
</head>";
?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句