April 13, 2000 - Copying HTML Content | 2 | WebReference

April 13, 2000 - Copying HTML Content | 2

Yehuda Shiran April 13, 2000
Copying HTML Content
Tips: April 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

An easy way to copy content between pages is to use the innerHTML and outerHTML properties. The outerHTML of a page includes all its HTML tags. The innerHTML property is the inner part of outerHTML, i.e. it does not include the outer most tag pair. Usually, you would assign the outerHTML of the source page to the innerHTML of the target page:

targetObj.innerHTML = sourceObj.outerHTML;

If, for example, the copied structure is a table, the innerHTML will not include the <TABLE>...</TABLE> pair.

Learn more about popup windows creation and usage in Tutorial 1, Working with Windows.