Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows_onload

Status
Not open for further replies.

masif2000

Programmer
Jul 21, 2005
9
0
0
US
PLEASE HELP...

Here is what I am trying to do...

I have an ASP page that has two frames. One hidden and the other visible. On the visible frame, I am basically looping through a list of URLs. These URLs are basically for different ASP pages that do some client side printing. I am setting the location.href property of the hidden frame to call the asp page for printing. I am having two problems with it.

1- it loops through all URLs executing location.href command but only the last one actually makes it through.

2- I want to close the window when all URLs have been looped through. top.close() function executes too soon. and nont of the location.href work. (the above #1 only works when I remove top.close)

here is the code...

Code:
function window_onload() {
	var l_strAllURL;
	
	l_strAllURL = document.all("chkURL");
	if (typeof l_strAllURL[0] == "object"){
		for (var l_lngIdx = 0; l_lngIdx < l_strAllURL.length; l_lngIdx++){
			if (l_strAllURL[l_lngIdx].checked == false){
				l_strAllURL[l_lngIdx].checked = true;
								window.parent.fraPrintPage.location.href = l_strAllURL[l_lngIdx].value;	
				
				
			}
		}
	}

	top.close();

}
 
I'd say that you want some sort of callback function in the pages you're loading, so that the parent page knows to move onto the next URL.

Without this, or some suitable delay, all the URls will load in succession, giving the appearance of only the last one having loaded.

Well - that's my theory, anyway ;o)

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top