I am trying to call a javascript function in a layout frame and keep getting the error that the function does not exist.
parent.dhxLayout.cells(‘b’)._frame.contentDocument.RPC();
Any ideas?
Well the above method does work for accessing html elements, but I still was not able to access a javascript function. Currently the only way I have called a js function in another frame is to do it this way:
parent.frames[4].activateDD();
I have tried this in firefox with no luck:
parent.dhxLayout.cells(‘b’).window._frame.contentDocument.activateDD();
I would like the second way to work since the first way could change.
Can someone please tell me what I am doing wrong?
page_1.html >>
…
page index.html >>
…
var dhxLayout = new dhtmlXLayoutObject(…);
…
dhxLayout.cells(“a”).attachURL(“page_1.html”);
// calling function from inner page
dhxLayout.cells(“a”).window._frame.contentWindow.myFunc();
The solution provided above did not work in my case.
I want to call a function on click of a node on tree in page1.htm to execute a javascript in page2.htm that is attached to layout.
This is the senario:
page1.htm
function doOnLoad(){
myLayout = new dhtmlXLayoutObject(document.body, “2U”, “dhx_blue”);
myTree = myLayout.cells(“a”).attachTree(“0”);
…
myTree.setOnClickHandler(onNodeSelect);
}
function onNodeSelect(nodeId){
…
var lv_url="./path/page2.htm";
myLayout.cells(“b”).attachURL(lv_url);
myLayout.cells(“b”).window._frame.contentWindow.justcall();
}
page2.htm
function justcall(){
alert(“successes!”); // does not work
}
Please let me know how can I make it work?
In the latest layout version you can call the function by:
myLayout.cells(“b”)._frame.contentWindow.justcall();
But this function can be called only when the “./path/page2.htm” page is loaded into iframe.
Yes this worked:
myLayout.cells(“b”)._frame.contentWindow.justcall();
thanks a lot!
Dear Alexandra,
Its not working. I thought it was but seems not working. Please help.