2009-06-08 102 views
0

我有一个由一个文本框和按钮组成的窗体。在一个按钮上单击一个弹出窗口出现,其中包含一个数据网格,我可以从中选择值, textbox(使用javascript)。在IE6和IE7中,我可以从弹出的网格中选择值,但在IE8中,Mozilla和Chrome iam无法选择。可能是什么原因。是否有人可以帮助解决此问题? 以下javascript我用来将弹出窗口中选定的值绑定到文本框。 函数回传(FieldId,fieldValue方法) {datagrid/textbox在IE 6/7中工作,但不是其他人

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; 

} 

以下是我在网格的数据绑定正在呼叫的代码。

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

您需要张贴一些代码... – cgreeno 2009-06-08 09:45:39

回答

1

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

0

几个关键点:

1),因为这会影响IE8和其他浏览器,这是非常可能你已经陷入与IE8修复正确实现document.getElementById(id)。在以前的IE版本中,IE会返回一个匹配项,它们是一个匹配“名称”属性的元素,。这是实施过程中的主要错误,但很多网站基于IE的bug构建了代码。 bug report and fix for IE versions before IE8

2)什么是你:

GetCenterWindowParams(); 

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

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

相关问题