Within showModalDialog, assuming your textboxes have IDs of "txtForename" and "txtSurname":
var o = new Object();
o.forename = document.getElementById("txtForename").value;
o.surname = document.getElementById("txtSurname").value;
window.returnValue = o;
If you do it like that you need to test the reurnValue to make sure it's not null which can happen if someone closes the modal dialog using a method other than the prescribed button, ALT+F4 for example.
actually this is the scenario
user should enter a value 2 times, after his first entry i dump that in to database and redirect to new page for 2nd entry. At 2nd entry it shud compare it with first entry, if it false then it shud popup with modal dialog showing first and second entry and asking him for correct entry and that value shud be passsed to 2nd entry page and that value be assigned to textbox value here I was able to do up correct entry but I was not able to pass correct entry textbox value from modal dialog to 2nd entry page textbox value
here is the code
aForm = oForm.elements;
var myObject = new Object();
myObject.firstName = aForm.entry2.value;
// The object "myObject" is sent to the modal window.
window.showModalDialog("child_args.html", myObject, "dialogHeight:300px; dialogLeft:200px;");
<form id= "oForm" action="">
<input type="text" name="entry2" id="entry2" value="" maxlength="4" onchange="fnLaunch();" />