The basics:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Parent page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
//<![CDATA[
<!--
function OpenWin() {
var content='<form action="#" name="childform">'+
'<input type="text" id="newtext" /><br />'+
'<button type="text" onclick="opener.InsertField(document.getElementById("newtext").value);">Add field</button>'+
'</form>';
ChildWindow=window.open("", "newwin");
ChildWindow.document.write(content);
ChildWindow.document.close();
}
var idx=0;
function InsertField(text) {
var newField=document.createElement('input');
newField.setAttribute('id','newField'+(idx++));
newField.setAttribute('type','text');
newField.setAttribute("value", text);
document.getElementById('myform').appendChild(newField);
}
//-->
//]]>
</script>
</head>
<body>
<form action="#" id="myform">
<button type="text" onclick="OpenWin();">edit</button>
<button type="submit">submit</button>
</form>
</body>
</html>
Bookmarks