Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search 如何在iframe和新页面中加载搜索结果?_Search_Load - Fatal编程技术网

Search 如何在iframe和新页面中加载搜索结果?

Search 如何在iframe和新页面中加载搜索结果?,search,load,Search,Load,好的,我完全不知道这些。但是我需要在我的网站的另一个页面上用iframe打开搜索结果。有人已经这样做了吗 例如,当您点击go时,它将重定向到我的网站的不同页面以及iframe中的搜索结果 代码是这样的: <html> <head> <title>Google Preview</title> <style>iframe { width: 800px; height: 600px }</style> &l

好的,我完全不知道这些。但是我需要在我的网站的另一个页面上用iframe打开搜索结果。有人已经这样做了吗

例如,当您点击go时,它将重定向到我的网站的不同页面以及iframe中的搜索结果

代码是这样的:

<html>
  <head>
    <title>Google Preview</title>
    <style>iframe { width: 800px; height: 600px }</style>
  </head>
  <body>
    <form method='get' action='http://www.google.com/search' target='results'>
      <label for='q'>Google Search:</label>
      <input name='q'/>
      <input type="submit" value="Go">
    </form>
    <script>
      try {
        document.write('<iframe name="results"></iframe>');
      } catch (e) {
        alert(e);
      }
    </script>
  </body>
</html>

谷歌预览
iframe{宽度:800px;高度:600px}
谷歌搜索:
试一试{
文件。写(“”);
}捕获(e){
警报(e);
}

提前谢谢

就我个人而言,我会先编写iframe(没有src),然后隐藏它,然后在发生操作时将源代码更改为您想要的任何内容,然后取消隐藏它,从而简化此行为

请注意,出于竞争原因,谷歌不允许在iframe中使用他们的结果。

相关: