How do you make sure a frameset is loaded? I'm trying to open a frameset in a new window which shows

C

ck388

I am trying to open a frameset in a new window......where the frame
called "main" shows the file called customerGeneral.aspx. I can't get
it to work though...i always get something like frames.main.location
is null....seems like the frameset is not loaded before
wnd.frames["main"].location.replace(URL) is called. If i add an
alert("TEST") between the window open and the frame
replacement....then it works. The alert("TEST") seems to ensure that
the frameset is loaded so the wnd.frames["main"].location.replace(URL)
executes without an error of null.

I have included my code below.

Any suggestions?

function openInFrame(URL) {
var wnd = window.open('frames/main.htm');
// if i add this alert("TEST") it works.
wnd.frames["main"].location.replace(URL);
}

e.Item.Cells[1].Text = "<a href=\"javascript:void(0)\"
onclick=\"openInFrame('" + "customerGeneral.aspx?ID=" + ID + "')\">" +
"This is a test" + "</a>";
 
C

ck388

I am trying to open a frameset in a new window......where the frame
called "main" shows the file called customerGeneral.aspx. I can't get
it to work though...i always get something like frames.main.location
is null....seems like the frameset is not loaded before
wnd.frames["main"].location.replace(URL) is called. If i add an
alert("TEST") between the window open and the frame
replacement....then it works. The alert("TEST") seems to ensure that
the frameset is loaded so the wnd.frames["main"].location.replace(URL)
executes without an error of null.

I have included my code below.

Any suggestions?

function openInFrame(URL) {
var wnd = window.open('frames/main.htm');
// if i add this alert("TEST") it works.
wnd.frames["main"].location.replace(URL);
}

e.Item.Cells[1].Text = "<a href=\"javascript:void(0)\"
onclick=\"openInFrame('" + "customerGeneral.aspx?ID=" + ID + "')\">" +
"This is a test" + "</a>";

I figured out a work around. I used the ONLOAD method of the
<frameset>. I did <frameset onload=
window.frames["main"].location.replace("thePage.htm"). Make sure the
frameset page is an ASPX page so you can replace the page with the
correct page.

Regards,

Tim :)
 

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

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,829
Latest member
PIXThurman

Latest Threads

Top