PDA

View Full Version : Problem DHTML Window widget object



Destiny
11-02-2007, 11:16 PM
1) Script Title: DHTML Window widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem:

For begin, my page : Live RACE24H V2 BETA (http://www.race24h.org/live2/race24h_live.php)

So,

in DHTML Window IFRAME (OPTION), i call function (predef1(type)) from PARENT page (1024*768 link in OPTION Windows).
In this function, i want close OPTION Window, call some function for create someone DHTML Window IFRAME (LIVE & LIVE SERVER MAP) and move this new Window to adjust in screen.


//Affiche le live TV
function LiveTV(height, width) {
if (livetvwin) {
livetvwin.close();
}

var widthSup = 0;
var heightSup = 0;
if (navigator.appName=='Microsoft Internet Explorer') {
widthSup = 4;
heightSup = 6;
}

var livetvwin=dhtmlwindow.open("winLiveTv", "iframe", "live_tv.php?w=" + width + "&h=" + height, "Live RACE24H > TV", "width=" + (width+widthSup) + "px,height=" + (height + heightSup) + "px,resize=0,scrolling=1,center=1", "recal")
}

//Affiche l'historique
function historic() {
var histowin=dhtmlwindow.open("winHisto", "iframe", "http://www.gtr-online.com/modules/GTROnline/live/enduro/stathistoric.php?gameid=3", "Live RACE24H > Historique", "width=590px,height=365px,resize=1,scrolling=1,center=1", "recal")
}

//Affiche l'historique
function option() {
var optionwin=dhtmlwindow.open("winOption", "iframe", "live_option.php", "Live RACE24H > Option", "width=590px,height=365px,resize=1,scrolling=1,center=1", "recal")
}

//Affiche la map
function trackMap(type) {
var mapwin=dhtmlwindow.open("winMap", "iframe", "map.htm", "Live RACE24H > Track Map", "width=590px,height=365px,resize=1,scrolling=1,center=1", "recal")
}

//Affiche les infos server
function info(type) {
var infowin=dhtmlwindow.open("winInfo", "iframe", "info.htm", "Live RACE24H > Info", "width=590px,height=365px,resize=1,scrolling=1,center=1", "recal")
}

//Predef 1
function predef1(type) {
//optionwin.hide();
if (type == "r1024") {
LiveTV(500, 500);
trackMap('server1');

livetvwin.moveTo(1, 1);
mapwin.moveTo(540, 1);
} else {
LiveTV(500, 500);
trackMap('server1');
}
}



optionwin.hide();
doesnt work (optionwin is not defined) IE&FF

livetvwin.moveTo(1, 1); mapwin.moveTo(540, 1);
doesnt work (livetvwin & mapwin is not defined) IE&FF

*ALL function for create window WORK, try in page ! i have try some code, no one works :(

Destiny
11-03-2007, 12:41 PM
Ok, problem resolve !

It's because i create an object in function, so the var of this one is not "global" ! Just "return var" in function to use it in another function (only if you call a fonction with return).


//Affiche le live TV
function LiveTV(height, width) {
if (livetvwin) {
livetvwin.close();
}

var widthSup = 0;
var heightSup = 0;
if (navigator.appName=='Microsoft Internet Explorer') {
widthSup = 4;
heightSup = 6;
}

var livetvwin=dhtmlwindow.open("winLiveTv", "iframe", "live_tv.php?w=" + width + "&h=" + height, "Live RACE24H > TV", "width=" + (width+widthSup) + "px,height=" + (height + heightSup) + "px,resize=0,scrolling=1,center=1", "recal")
return livetvwin;
}

//Affiche la map
function trackMap(height, width, type) {
var mapwin=dhtmlwindow.open("winMap", "iframe", "map.htm", "Live RACE24H > Track Map", "width=590px,height=365px,resize=1,scrolling=1,center=1", "recal")
return mapwin;
}

//Predef 1
function predef1(type) {
//optionwin.hide();
if (type == "r1024") {
livetvwin = LiveTV(500, 500);
mapwin = trackMap('server1');

livetvwin.moveTo(0, 31);
mapwin.moveTo(504, 31);
} else {
LiveTV(500, 500);
trackMap('server1');
}
}



But one problem stay, how close window "optionwin.hide();". he dont know this object ...