Categories | Question details Back To List | ||
access dhtmlxWindow content Hi, I have created a dhtmlxWindow, attached a url using ajax, and am trying to access an element within it. I created the window like so: ---------- var dhxWins = new dhtmlXWindows(); var ajaxApplicationWindow = null; function ajaxApplicationWindowOpen(title, url) { ajaxApplicationWindow = dhxWins.createWindow('ajaxApplicationWindow', 0, 0, 400, 570); ajaxApplicationWindow.centerOnScreen(); ajaxApplicationWindow.setText(title); ajaxApplicationWindow.denyResize(); ajaxApplicationWindow.button("park").disable(); ajaxApplicationWindow.button("park").hide(); ajaxApplicationWindow.button("minmax1").disable(); ajaxApplicationWindow.button("minmax1").hide(); ajaxApplicationWindow.attachURL(url, true); } ajaxApplicationWindowOpen('foo', 'foo.html'); ---------- I've written a function to get at the element using your example: ---------- function getWindowElementById(windowId, elementId) { if (_isIE) { return dhxWins.window(windowId)._frame.contentWindow.document.getElementById(elementId); } else { return dhxWins.window(windowId)._frame.contentDocument.getElementById(elementId); } } ---------- I am trying to access the element like so... alert(getWindowElementById('ajaxApplicationWindow', 'id').value); ...but it errors in Firefox with 'dhxWins.window(windowId)._frame is null' :-/ Please advise. Answer posted by Alex (support) on Mar 11, 2009 09:17 Hello, You use ajax loading. The pages aren't placed into iframes. So, you can try a simple approach: function getWindowElementById(windowId, elementId) { return document.getElementById(elementId); } Answer posted by mallchin on Mar 11, 2009 09:25 Works great, thanks! I had made the mistake of referencing an id that didn't exist (oops) which naturally errored. I assumed it was because I needed to access the iframe. |