js: how to pass the content(only body , no header and footer) of webpage in one div tab to another div tab
i want to copy the body content of webpage in one div tab to another div tab without header and footer.
i dont want the bing header and footer in the second div tab . only the body should be visible, that is only the search results should be visible.
as of now, in both the tabs i get bing results with bing icon and search bar on the top. but now i do not want this result . i only want the search results in the second div tab. please help.??
<html>
<head>
<script>
function querify(query) {
return query.split(" ").join("+") // replaces spaces with +s for url
}
function upd(query) {
query = querify(query);
var i1 = document.getElementById("searchResults1");
var i2 = document.getElementById("searchResults2");
var i3 = document.getElementById("searchResults3");
var searchEngine = "https://www.bing.com/search?q="
var yourSiteToSearch1= "site:google.com+"
var yourSiteToSearch2= "site:google.com+"
var yourSiteToSearch3= "site:youtube.com+"
i1.src = searchEngine + yourSiteToSearch1 + query;
i2.src = searchEngine + yourSiteToSearch2 + query;
i3.src = searchEngine + yourSiteToSearch3 + query;
}
function myFunction(){
var elmnt =document.getElementById("searchResults1").contentWindow.document.getElementById("b_header");
elmnt.style.display = "none";
}
</script>
</head>
<head>
<style>
.fdiv {
border: 2px solid;
padding: 20px;
width: 300px;
resize: both;
overflow: auto;
}
</style>
</head>
<head>
<style>
.ediv {
border: 2px solid;
padding: 20px;
width: 300px;
resize: both;
overflow: auto;
}
</style>
</head>
<body>
<div>
<input type="text" placeholder="Search" id="searchText">
<button onclick="upd(document.getElementById('searchText').value); myFunction()">search</button>
</div>
<div class="fdiv">
<iframe id="searchResults1" height="100%" width="100%"></iframe>
</div>
<div class="ediv">
<iframe id="searchResults2" height="100%" width="100%"></iframe>
</div>
</body>
</body>
</html>
Comments
Post a Comment