这是我的html代码:
<html>
</head>
<body>
<div id="link">
<a href="http://www.google.com">google</a>
</div>
<div id="result"></div>
</body>
</html>
</html>
我想输出类似这样的东西
点击谷歌然后它在那里显示导致其他div
谢谢
这是我的html代码:
<html>
</head>
<body>
<div id="link">
<a href="http://www.google.com">google</a>
</div>
<div id="result"></div>
</body>
</html>
</html>
我想输出类似这样的东西
点击谷歌然后它在那里显示导致其他div
谢谢
试试下面的javascript代码
var el=document.getElementById("result");
el.innerHTML="<iframe src=\'http://www.google.com\'></iframe>";
试试看... Google Web Search API
<script src="https://www.google.com/jsapi" type="text/javascript"></script> <script language="Javascript" type="text/javascript"> google.load('search', '1'); $('a').live('click',function OnLoad() { // Create a search control var searchControl = new google.search.SearchControl(); // Add in a full set of searchers var localSearch = new google.search.LocalSearch(); searchControl.addSearcher(localSearch); searchControl.addSearcher(new google.search.WebSearch()); searchControl.addSearcher(new google.search.VideoSearch()); searchControl.addSearcher(new google.search.BlogSearch()); searchControl.addSearcher(new google.search.NewsSearch()); searchControl.addSearcher(new google.search.ImageSearch()); searchControl.addSearcher(new google.search.BookSearch()); searchControl.addSearcher(new google.search.PatentSearch()); // Set the Local Search center point localSearch.setCenterPoint("New York, NY"); // tell the searcher to draw itself and tell it where to attach searchControl.draw(document.getElementById("searchcontrol")); // execute an inital search searchControl.execute("VW GTI"); } google.setOnLoadCallback(OnLoad); </script>
最好的方法是制作 2 个不同的网页(您的初始页面和您的结果),然后将它们放入 iframe 中。你可以在这里看到一个演示:链接
试试这个它的工作......
首先你创建一个 PHP 文件:-
<?php
$ch = curl_init($_POST['action']);
curl_setopt($ch, CURLOPT_POST, FALSE);
//curl_setopt($ch, CURLOPT_URL, $r->event_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);
curl_close($ch);
echo $html;
?>
javascript代码:-
function result(url)
{
$.ajax({ url: 'one.php',
data: {action: url},
type: 'post',
success: function(output) {
$('#result').html(output);
}
});
}
3.code for your html file:-
<body>
<div id="link">
<a href="javascript:void(0)" onclick="result('https://www.google.co.in/')">google</a>
</div>
<div id="result" height="200" width="200"></div>
</body>