Forum Moderators: open

Message Too Old, No Replies

Pop up window

         

Punter

9:50 am on Feb 4, 2009 (gmt 0)

10+ Year Member



I want to take parameters from popup window onto parent window.
I want to display data selected in popup window and put it in a <div>
on parent window & display it on parent window.

How do I do that?

RonPK

3:58 pm on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As I said in reply to your previous question: you can use the popup window's
window.opener
property to pass commands to the parent window.

How do you let the user select data in the popup?

As for showing it in a <div>: address the div via its ID, and change the value of the div's

innerHTML
property.

rocknbil

5:39 pm on Feb 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are many window.openers samples here on webmasterworld, here's one more apologies to RPK, seems like poster is not getting your concise replies . . .

This comes in two parts.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- doctype all on one line -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Window.Opener Test</title>
<script type="text/javascript">
function newWindow () {
var day = new Date();
var id = day.getTime();
var params='width=600,height=600,scrollbars,resizable';
var win = open('popwin.html',id,params);
}
</script>
</head>
<body>
<h1>Window.Opener Test</h1>
<p><a href="#" onClick="return newWindow();">Open editor</a></p>
<p id="write_me"></p>
</body>
</html>

Contents of file "popwin.html:"


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- doctype all on one line -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Window.Opener Part Two</title>
<script type="text/javascript">
function populate () {
if (document.getElementById) {
var txt = document.getElementById('txt').value;
var target = window.opener.document.getElementById('write_me');
target.innerHTML=txt;
window.close();
return false;
}
}
</script>
</head>
<body>
<h1>Window.Opener Part Two</h1>
<form action="" onSubmit="return populate();">
<textarea name="txt" id="txt" rows="6" cols="25">Enter some text here</textarea>
<input type="submit" value="Populate Parent and Close">
</form>
</body>
</html>

Punter

4:23 am on Feb 5, 2009 (gmt 0)

10+ Year Member



thnx a lot guys.......
understood.....