我的iFrame看起来像这样:
<iframe id="iframe" name="iframe1" frameborder="0" src=""></iframe>
Run Code Online (Sandbox Code Playgroud)
我的脚本看起来像这样:
<script type="text/javascript">
$(document).ready(function() {
$('#iframe').attr('src',http://google.com);
})
</script>
Run Code Online (Sandbox Code Playgroud)
我也试过在网址上加引号:
<script type="text/javascript">
$(document).ready(function() {
$('#iframe').attr('src','http://google.com');
})
</script>
Run Code Online (Sandbox Code Playgroud)
但两者都没有效果.
我错过了什么?
我正在尝试使用Google Chrome浏览器中的开发者工具控制台单击网页上的按钮。
该按钮的HTML为:
<input value="Send an Email" class="btn" name="email" onclick="navigateToUrl('/_ui/core/email/author/EmailAuthor?p2_lkid=00QU0000008xZYi&rtype=00Q&retURL=%2F00QU0000008xZYi','RELATED_LIST','email');" title="Send an Email" type="button">
Run Code Online (Sandbox Code Playgroud)
如您所见,该按钮没有id属性,因此我试图使用该name属性来选择它。我的JavaScript代码是:
document.getElementsByName("email").click()
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我想在iframe中加载一个响应式设计网站作为我网站的一个页面.但是,当它加载到iframe中时,该网站会失去响应能力.
以Mashable.com为例(内置响应式设计) - 我的代码如下所示:
<body>
<style>
body {width:100%;height:100%;margin:0;overflow:hidden;background-color:#252525;}
#iframe {position:absolute;left:0px;top:0px;}
</style>
<iframe id="iframe" name="iframe1" frameborder="0" width="100%" height="100%" src="http://mashable.com"></iframe>
</body>
Run Code Online (Sandbox Code Playgroud)
如果您通过手机访问mashable.com,您将看到响应式设计的实际应用.但是,如果您在手机上访问上面的页面,则mashable的响应式设计无法正常运行.
有谁知道如何在div中加载网页并保持其响应式设计?
提前致谢!