readyState and document.write()

M

michaeljwhitmore

Hey all, just a quick question to fine tune some code and answer a
question...

I am searching files for values and made a separate search window that
displays progress as each file is completed. Code snippets below.

I don't want to start find() until gSearchBarWindow is ready to go so I
test it's readyState, obviously if I try to call AdvanceSearchBar()
without the window being completely loaded --- KaBAM!!! The problem I
face is that once I load HTMLData the window reverts from "complete" to
"Interactive" and doesn't change. What signal do I send the window to
let it know I am not throwing any more data into it?





// Chopped up code
function CreateSearchWindow() {
HTMLData = '<html>\n';
HTMLData += assume valid html to render searchbar
HTMLData += '</html>\n';
gSearchBarWindow = open("",
"SearchWindow","top="+TopSideWindow+",left="+LeftSideWindow+",height="+DesiredHeight+",width="+DesiredWidth+",scrollbars=no,menubar=no,resizable=no,toolbar=no,locationbar=no,status=no,titlebar=no");
gSearchBarWindow.document.write(HTMLData);
go_Timer = setInterval(WaitUntilLoaded, 5);
}




function WaitUntilLoaded() {
if (gSearchBarWindow.document.readyState == "complete" ||
gSearchBarWindow.document.readyState == "interactive") {
clearInterval(go_Timer);
//alert("gi_NumberOfWaits = " +gi_NumberOfWaits);
find();
} else {
gi_NumberOfWaits++;
}
}




function find() {
var Index = 0;
while (Index < NumberOfFiles) {
gSearchBarWindow.AdvanceSearchBar();
// Do the search and load results
Index++;
}
}




Thanks in advance, and I really did do a lot of searching before this
post went out...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top