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