Demo:
Hovedside:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Popup and sendback</title>
<script type="text/javascript">
var popwin;
function receiveFromPopup(strParm) {
popwin.close();
var elm = document.getElementById("returnID");
elm.appendChild(
document.createTextNode(strParm)
);
elm.appendChild(
document.createElement("br")
);
}
function StartPopup() {
popwin = window.open( 'popup.html', '_blank', "height=200,width=300,status=no,toolbar=no,menubar=no,location=no");
}
</script>
</head>
<body>
<h3>Test value from popup</h3>
<div id="returnID" style="border: 2px solid gray; padding: 5px;"></div>
<p>
<input type="button" value="Open Popup" onclick="StartPopup()">
</p>
</body>
</html>
Popupside:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Popup and sendback</title>
</head>
<body style="padding: 50px;">
<form action="" onsubmit="opener.receiveFromPopup(this.message.value); return false;">
<input name="message" type="text" value="type your message here" onfocus="this.select();">
<input type="submit" value="Send data back">
</form>
</body>
</html>