views:

401

answers:

2

hi guys, I have a form consisting of one textbox and button.On clicking on button one popup appears which contains one datagrid from which i can select value ,such that value appears in textbox(using javascript).In IE6 and IE7 ,i can select value from grid in popup,but in IE8,Mozilla and chrome iam not able to select.What may be the reason.Can anybody help to solve this issue? Following javascript i used to bind value selected in popup to textbox. function PassBack(FieldId,FieldValue) {

if (window.opener && !window.opener.closed)
{
     window.opener.document.getElementById(strFieldName).value = FieldValue;
     window.opener.document.getElementById(strhidFieldName).value = FieldId;
     window.opener.document.getElementById(strFieldName).focus();
     window.close();
}

}

function openPopup(hidfield_name,field_name,SType) 
{
    url = location.protocol+'//'+ location.host + '/User/Search.aspx?refId='+field_name+'&SearchType='+SType+'&hidid='+hidfield_name;
    if (!newwindow.closed && newwindow.location)
     {
     newwindow.location.href = url;
    }
    else
     {
     GetCenterWindowParams();

     newwindow=window.open(url,'winLOV', 'scrollbars=yes,resizable=yes,width=470,height=400,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
     if (!newwindow.opener) newwindow.opener = self;
    }
    if (window.focus) {newwindow.focus()}
    return false;

}

Following is the code which i am calling in the databound of the grid.

  currentCell.Attributes.Add("OnClick", "javascript:PassBack('" & CType(e.Item.DataItem, DataRowView).Row(0) & "','" & str.Trim & "');")
+1  A: 

Not without having a look at your code. But it would seem you are using some IE specific javascript.

aanund
A: 

A few key points:

1.) Since this affects IE8 and all other browsers, it is very likely you've been caught with the fix in IE8 to properly implement document.getElementById(id). In previous versions of IE, IE would return matches that were a.) a dIfFeReNt CaSe match, AND elements that had a matching "name" attribute. This were major errors in the implementation, but a lot of sites built code based on IE's bug. (bug report and fix for IE versions before IE8)

2.) What does your:

GetCenterWindowParams();

Function populate? I don't see where you are getting your xOffset, yOffset values from.

3.) Do you define "self" somewhere? unless you have defined it, "self" is not a synonym for "this".

scunliffe