opener property in Java Script

Using "opener" property, we can access the main window from the newly opened window.

Let's create Main page:

<html>
<head>
<title>Main Page</title>
</head>
<body>
<form>
<input type="button" value="Open another page"
onClick="aa=window.open('test.htm','','width=100,height=200')">
</form>
</body>
</html>

Then create Remote control page (in this example, that is test.htm):
<html>
<head>
<title>Child Page</title>
<script>
function remote(url)
{
window.opener.location=url
}
</script>
</head>

<body>
<p><a href="#" onClick="remote('file1.htm')">File1</a></p>
<p><a href="#" onClick="remote('file2.htm')">File2</a></p>
</body>

</html>

2 comments :

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger