Write a JavaScript program for writing content to child window.
<html>
<head>
<title>Writing to child window using JS</title>
<script>
function addContent()
{
window.topPage.document.open();
window.topPage.document.write('<html>');
window.topPage.document.write('<body>');
window.topPage.document.write('<form action="">');
window.topPage.document.write('<input type="text"/>');
window.topPage.document.write('<input type="button" value="submit"/>');
window.topPage.document.write('</form>');
window.topPage.document.write('</body>');
window.topPage.document.write('</html>');
window.topPage.document.close();
}
</script>
</head>
<frameset rows="25%, *" onload="addContent()">
<frame name="topPage"/>
<frame src="webpage1.html" name="bottomPage"/>
</frameset>
</html>
<html>
<head>
<title>Webpage 1</title>
</head>
<body>
<h1>Webpage 1</h1>
</body>
</html>
<html>
<head>
<title>Webpage 2</title>
</head>
<body>
<img name="targetImage" alt="No image selected"/>
</body>
</html>
