【发布时间】:2016-10-11 01:33:13
【问题描述】:
您好,我有以下 html 文档:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mytitle</title>
<style>
#idiv {
position: fixed;
top:1px;
height:100px;
left: 0px;
right: 0px;
bottom: 0px;
background:#0C0;
}
#iframe_main {
position:fixed;
top:100px;
height: 100%;
width: 100%;
}
</style>
<style>
.myButton {
-moz-box-shadow:inset 0px 0px 27px 7px #fff6af;
-webkit-box-shadow:inset 0px 0px 27px 7px #fff6af;
box-shadow:inset 0px 0px 27px 7px #fff6af;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffec64), color-stop(1, #ffab23));
background:-moz-linear-gradient(top, #ffec64 5%, #ffab23 100%);
background:-webkit-linear-gradient(top, #ffec64 5%, #ffab23 100%);
background:-o-linear-gradient(top, #ffec64 5%, #ffab23 100%);
background:-ms-linear-gradient(top, #ffec64 5%, #ffab23 100%);
background:linear-gradient(to bottom, #ffec64 5%, #ffab23 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffec64', endColorstr='#ffab23',GradientType=0);
background-color:#ffec64;
-moz-border-radius:27px;
-webkit-border-radius:27px;
border-radius:27px;
border:1px solid #ffaa22;
display:inline-block;
cursor:pointer;
color:#333333;
font-size:18px;
font-weight:bold;
padding:8px 10px;
text-decoration:none;
text-shadow:-12px 12px 11px #ffee66;
}
.myButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffab23), color-stop(1, #ffec64));
background:-moz-linear-gradient(top, #ffab23 5%, #ffec64 100%);
background:-webkit-linear-gradient(top, #ffab23 5%, #ffec64 100%);
background:-o-linear-gradient(top, #ffab23 5%, #ffec64 100%);
background:-ms-linear-gradient(top, #ffab23 5%, #ffec64 100%);
background:linear-gradient(to bottom, #ffab23 5%, #ffec64 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffab23', endColorstr='#ffec64',GradientType=0);
background-color:#ffab23;
}
</style>
</head>
<body>
<div id="idiv">
<input class="myButton" style="left: 10px; width:auto; height:auto; visibility: visible;z-index: -0; width: auto" value="RELOAD PAGE" onclick="window.location.reload()"/>
</div>
<div style="top:100px;height: auto; width:auto;">
<?php
echo "<iframe id= \"iframe_main\" src=\"http://google.com/\"></iframe>";
?>
</div>
</body>
</html>
当我将此文档上传到我的网络服务器时,iframe 不加载 google,它想加载 iframe 源作为相对目标,而不是加载 google.com.. 如果我想加载 iframe 窗口,我需要做什么来自不同的域?
谢谢
【问题讨论】:
-
为什么要用echo,你那里的纯html页面?
-
我将从 mysqli 数据库加载(稍后)iframe 源