This blog is NOFOLLOW Free!
  • INCEPTION THEME

    Clean, contrasting WordPress theme built on the foundation of Whiskey Air.
  • WHISKEY AIR THEME

    Clean developer theme, suited for heavy modifications.
  • X5 TURBO THEME

    3 columns Turbo theme, now reloaded!
  • CLEAR APPLE THEME

    Almost magazine theme, without the hassle of administration.

I need to extract some data from a web page and place it on a fishing site. The source web page is updated frequently, and I don’t have the necessary time to update it. So, I’ll use the Javascript innerHTML function.

First of all, I should identify the element I’m trying to copy, let’s say a div with the ID info:

<div id="info">
This information updates daily.
</div>

The next step is to include the source web page as an IFRAME with width and height equal to 0:

<iframe name="thief" width="0" height="0" frameborder="0" src="source.html"></iframe>

The final code should read from the IFRAME and display the content on the destination page, in a specially created div:

<div id="destination">
This content will be replaced.
</div>

<script type="text/javascript">
// this script will copy the ontent of the 'info' div into the 'thief' div in the destination page
parent.document.all('thief').innerHTML = document.all('info').innerHTML;
</script>

6 Responses to Copy Web Page Content Using innerHTML

  • simple and great tips for lazy people like me :D

    Reply
  • I am feeling pretty slow here…cant seem to make this work. Where do you refernce the “destination” id in the code?

    Reply
  • The “destination” id should be a placeholder for the data you want copied.

    For example if you want to copy a sentence from another page on page x.html, you place the “destination” id div into x.html. Got it?

    Reply
  • Search Engines Parser is enormously fast, 100% automatic search engine results extractor you were dreaming about for many times. Search Engines Parser can extract results from all search engines at the same time, parse titles, descriptions and links automatically. You can specify which search engine(s) to use and what kind of data to parse. Search Engines Parser can output results to screen, export to MySQL database and write to CSV file.

    Reply
  • Ba frate ai explicat k curu aici , nu merge de nicio culoare ce povestesti tu pe aici

    Reply
  • @Raulz: mie mi-a mers, ai gresit tu ceva. Incerci local sau de pe net?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>