Javascript 如何在HTML中打开特定Div中的网站

Javascript 如何在HTML中打开特定Div中的网站,javascript,jquery,css,html,Javascript,Jquery,Css,Html,我想让它在一个特定的标签中打开一个网站,就像下面的链接一样:。我做错了什么 <html> <head> <script> function mobile320() { window.location.assign("http://www.idevtechnolabs.com") } </script> <style type="text/css"> body{ margin: 0px au

我想让它在一个特定的
标签中打开一个网站,就像下面的链接一样:。我做错了什么

<html>
<head>
  <script>
   function mobile320()
    {
     window.location.assign("http://www.idevtechnolabs.com")
    }
  </script>

<style type="text/css">
 body{
  margin: 0px auto;
  padding: 0px;
  background: #06855a;
  text-align: center;
 }

.browser1{
  display: inline-block;
  position: relative;
  width: 320px !important;
  height: 480px !important;
  background: #efefef;
 }
</style>
</head>

 <body>
   <input type="button" value="Load new document" onclick="mobile360()" />
   <div class="browser1"> </div>
 </body>
</html>

函数mobile320()
{
window.location.assign(“http://www.idevtechnolabs.com")
}
身体{
保证金:0px自动;
填充:0px;
背景#06855a;
文本对齐:居中;
}
.browser1{
显示:内联块;
位置:相对位置;
宽度:320px!重要;
高度:480px!重要;
背景:#efef;
}

这不是div,而是iframe:

<iframe src="http://www.google.com"></iframe>

在div中放置一个iframe元素并导航到所需的网站


或者执行http get请求,并将所需div的内部html设置为响应字符串u get。

将函数更改为:

function mobile320() {
    document.querySelector(".browser1").setAttribute("src", "http://www.idevtechnolabs.com");
}
…还有你对这件事的看法

<iframe class="browser1"></iframe>


.

如果你把帖子的标题放到谷歌上,你会看到很多结果。你试过什么了吗?最好把你的代码贴出来,而不是代码的截图:)@F.Geraerts Fixed。哎呀!塔沙古普塔:谢谢兄弟,你的回答满足了我的要求。。所有使用iFrame的方法都有助于实现+1,即使这个方法不起作用,使用google作为源代码;)没错,它只会在谷歌上起作用:)谢谢兄弟@zougen:)