...

View Full Version : Iframe part of page



millsi80
02-18-2009, 02:32 AM
Hi,

Is there a way to embed (iframe) a certain part of an external page, like the center of the external page for exmaple?

Thanks!

harbingerOTV
02-18-2009, 02:41 PM
if the external page is local, meaning not some other URL you can do that with jQuery as one way:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(function () {
$('div.iframe').load("test.html #foot");
});
});
</script>

<div class="iframe" style="height:400px;width:600px;border:1px solid #000; overflow: auto;"></div>

That will grab the local file test.html and load the div#foot into the div.iframe.

If you are trying to grab an external URL then something like this:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(function () {
$('iframe.iframe').attr("src", "http://google.com");
});
});
</script>

<iframe class="iframe" style="height:400px;width:600px;border:1px solid #000;"></iframe>

Now if you're trying to load an external URL into your div or iframe but only load a particular section via class or id, there might be a way but, I honestly don't know how.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum