Click to See Complete Forum and Search --> : works offline so why not online?


iweb99
08-25-2003, 11:18 AM
Ok been trying to figure this one out and getting no where…

This is the gist of what I’m trying to do…

I have a page (part of a web dev companies site) that provides users with online quotes, they select the type of site they want (from a combo box) and enter how many pages they want the site to be (in a textbox).

Then they click on a link which calls some JavaScript code which first validates their input then goes about calculating a quote, this quote (so far so good) is then output into a ready formatted html page using <Span> and the innerHTML command.

This is when I hit problems, I open a new window;

var msgWindow = window.open("../fees/printquote.htm", "msgWindow");

and then using some <span> tags I have embedded in printquote.htm I alter the content to suit the quote they have requested. For example ;

crtPtr = msgWindow.document.getElementById("domainCost");
crtPtr.innerHTML = "";
crtPtr.innerHTML = domain_fee;

This is where I get the error message “crtPtr is null or not an object”, meaning for some reason once the window is open I can no longer access it or its objects. The page still opens but the new content is not inserted.

The weird thing is this code works perfectly offline (even tried it on two different machines with different version of IE), so what I cant understand is why would it work offline but not online?

Hope someone can help me with this!

Khalid Ali
08-25-2003, 12:31 PM
2 posibilities

If the page you are opening is not being served from the same server then you can access the resources in the window( that should give u an "access denied" error).


Second you are trying to access the object while the document is not completely loaded???

iweb99
08-25-2003, 03:24 PM
Thanks again for the reply Khalid Ali,

I hadn’t thought of possibility 1 but it isn’t likely as both pages are hosted on the same server and also I didn’t get the “access denied” error either.

I suspect 2 is the likely candidate, I’m not sure how I would wait till the other window had loaded though and also if I do wait for the other window to load wouldn’t the original window lose focus (and therefore wouldn’t the script inserting the updates get dumped from memory).

Having read both of my posts and got an idea for what I’m trying to do can you think of any other methods of achieving what I’m trying to do here Khalid Ali? I can’t use server side languages (my hosting account doesn’t have the facility) the only thing I can come up with is using cookies as pseudo global variables.

I’d appreciate any ideas you have.

Khalid Ali
08-25-2003, 10:55 PM
you can try using setTimeout() method in the parent window,to give some time before the child window loads

iweb99
08-27-2003, 04:32 AM
Thanks, I'll try that.