b.aspx
<script language="javascript" type="text/jscript">
function btnSelect(Name) {
var sourceWindow = dialogArguments;
sourceWindow.Name= Name;
window.returnValue="ok";
window.close();
return false;
}
</script>
a.aspx
function selectContactList(custid)
{
var id = document.theForm(custid).value;
var sReturn=window.showModalDialog("../inc/selectContactList.aspx?id="+id,window,'dialogHeight:600px;dialogWidth:450px;status:no;help:no;');
if(sReturn=="ok"){
document.all("txtContactName").value=window.Name;
}}