How to get the windows ID


It’s possible to return in the window, the window ID?

This is a part of the code that create the Windows:

dhxToolbar7 = tabbar.cells("c9").attachToolbar();
dhxToolbar7.addButton("New", 1, "Crea nuovo operato...", "page_white_add.png", "page_white_add.png");
dhxToolbar7.attachEvent("onClick", function(id) {
if(id=="New") {
createWindow('Operato_add.php?CID=<? echo $_GET["CID"]; ?>','Aggiungi operato','500','372','yes');

Now in the opened page i want too display that this is the window with ID w1, is this possible?


There is a method of getting window’s ID getId(): … sngl_getid


I’m using this script:

dhxWins = new dhtmlXWindows();
var idPrefix = 1;
- url= address
- title: titol of the window
- w: width
- h: height
- r: is resizable?

function createWindow(url, title, w, h, r) {
	var p = 0;
	if (p>=5) {
			text:"Not more than 5 windows are allowed"
	var id = "userWin "+(idPrefix++);
	var win = dhxWins.createWindow(id, 20, 50, w, h);
	var winId= dhxWins.window(id)

Now I have 2 questions:

  • on the created window how can I get the id of the page, the getId() function don’t works :angry:
  • if the created window (window 2) is created on the parent (parent.createWindow(…) from another window (window 1) is there a way to obtain in window 2 the id of the first window, if the window would be created on the window 1 this window would be the parent, but in this case it’s not the parent but like a sister :stuck_out_tongue:


Please, try to use:

    var id = window.getId();

It returns the id of the window well for me.


I’m back again!!

But where I have to place this code. I have 3 files:

  1. is the “start file” in which i open the window using the createwindow.php file with a script like: onclick=’ parent.createWindow(“test.php?ID=1”,“Incassa conteggio commissioni”,450,280,0);"
  2. is the createwindow.php file that is fundamentally the script that generates the windows (see code on the first page
  3. the test.php file that is the file loaded in the window and it’s inside the window that I have to get the windows ID, so that I can for example change the size of the window, or the name, or simply close it.

And inside of the window the getID don’t work

As example here a code that I would like to use inside the window:

parent.dhxWins.window(******).setText(‘New page name’);

The ****** should be the ID that I have to retrieve inside the window, because i could also have more than one window.


Do you want to get the id of the window inside the iframe attached to that window? You may send the id of a created window as a parameter of an url to a content of that window and get it wen it needed from the url


Thany you Semantik, I hoped that it was a simplier solution :slight_smile: