2009-06-08 45 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」的同義詞。

相關問題