Hi there can anyone help, i have a developed a function that when called should open a window but it returns NULL. If i do the opening window in the original javascript function it works. I suppose its the original function passes control to the other function but for some reason this doesn't work..
Here is my original function, this basically calls a new javascript file and loads an HTML file and when "Ready" it needs to display the window.open with the html file which is now in the form of string.
order.prototype.printMe = function(){
order_resume.loadthis("myTestPage.html", "showData");
// OPENING WINDOW HERE WORKS; but the the html file that is loaded
// in above line hasn't finsihed loading - so i need to show it form
// the fucntion below once in "ready" state
/* child1 = window.open ("about:blank","_blank");
child1.document.write( myDocument );
child1.document.close();
*/
}
and heres is my fucntion that is called from original function
function showResume(){
this.req = false;
reservaResumen.prototype.showData = function(){
if (this.req.readyState == 4) {
child1 = window.open("about:blank", "_blank"); /// THIS RETURNS NULL
child1.document.write("test");
child1.document.close();
}
}
reservaResumen.prototype.loadthis= function(url, myMethod){
if (window.XMLHttpRequest && !(window.ActiveXObject)) {
try {
this.req = new XMLHttpRequest();
}
catch (e) {
this.req = false;
}
}
else
if (window.ActiveXObject) {
try {
this.req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
this.req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
this.req = false;
}
}
}
if (this.req) {
var loader = this;
this.req.onreadystatechange = function(){
eval("loader." + myMethod+ ".call(loader)")
}
this.req.open("GET", url, true);
this.req.send("");
}
}