datagrid / textbox适用于IE 6/7,但不适用于其他版本

时间:2022-04-21 17:30:02

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) {

我有一个由一个文本框和按钮组成的表单。单击按钮会出现一个弹出窗口,其中包含一个数据网格,我可以从中选择值,这样该值就会出现在文本框中(使用javascript)。在IE6和IE7中,我可以从中选择值弹出网格,但在IE8,Mozilla和chrome iam无法选择。可能是什么原因。任何人都可以帮助解决这个问题?以下javascript我习惯将弹出窗口中选择的值绑定到文本框。 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 & "');")

2 个解决方案

#1


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

不是没有看你的代码。但它似乎你正在使用一些IE特定的JavaScript。

#2


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)

1.)由于这会影响IE8和所有其他浏览器,因此很可能您已经在IE8中遇到了正确实现document.getElementById(id)的修复程序。在以前的IE版本中,IE将返回匹配的匹配项。)dIfFeReNt CaSe匹配,AND元素具有匹配的“name”属性。这是实现中的主要错误,但很多站点都是基于IE的bug构建代码的。 (在IE8之前的IE版本的错误报告和修复)

2.) What does your:

2.)你的:

GetCenterWindowParams();

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

功能填充?我没有看到你从哪里得到你的xOffset,yOffset值。

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

3.)你在某处定义“自我”吗?除非你已经定义了它,否则“self”不是“this”的同义词。

#1


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

不是没有看你的代码。但它似乎你正在使用一些IE特定的JavaScript。

#2


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)

1.)由于这会影响IE8和所有其他浏览器,因此很可能您已经在IE8中遇到了正确实现document.getElementById(id)的修复程序。在以前的IE版本中,IE将返回匹配的匹配项。)dIfFeReNt CaSe匹配,AND元素具有匹配的“name”属性。这是实现中的主要错误,但很多站点都是基于IE的bug构建代码的。 (在IE8之前的IE版本的错误报告和修复)

2.) What does your:

2.)你的:

GetCenterWindowParams();

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

功能填充?我没有看到你从哪里得到你的xOffset,yOffset值。

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

3.)你在某处定义“自我”吗?除非你已经定义了它,否则“self”不是“this”的同义词。