JavaScript code can't $get a control in windows7 but can in xp
The following javascript function used to work:
function tbComment_onKeyDown(ID) {
var commentPop = $find("WebDialogWindowComment")
commentPop.set_windowState($IG.DialogWindowState.Normal);
commentID = ID;
var thePopUpTb = $get("WebDialogWindowComment$tmpl$tbCommentPopUp");
thePopUpTb.focus();
thePopUpTb.value = commentID.v开发者_JAVA百科alue;
}
What it did was onKeyDown on a textbox on my aspnet (3.5) form, it caused an infragistics WebDialogWindow to become visible, set the focus to a textbox in that window, and copied over any text from the original texbox to the textbox in the WebDialogWindow.
Now, $get("WebDialogWindowComment$tmpl$tbCommentPopUp"); is returning null. When I look at View Source on the page, WebDialogWindowComment$tmpl$tbCommentPopUp is on the page.
I am running the code thru (the webbrowser in )vs2008 . The only difference I can think of from when it worked to now, is that I upgraded from vista to windows7. I am not using JQuery.
Also, this code works thru vs2008 on another, xp, machine.
And, the application on the development server (an xp machine) runs on my windows 7 machine.
Can anyone help out with what is going on here?
WebDialogWindowComment$tmpl$tbCommentPopUp
looks like an element name. $get() works with element ids, not names. Try:
var thePopUpTb = $get("WebDialogWindowComment_tmpl_tbCommentPopUp");
Prior to version 8, Internet Explorer mistakenly accepted element names in its document.getElementById() method. That's probably why your code works under IE7 on Windows XP.
精彩评论