JS Questions for opening a page in a window

_________ Frame1 ________

Frame2 | Frame3

	|

	|

	|

	|

What I am intending to do?

Frame3 has a field with dropdown list box. In Frame3, user makes a seleciton from a field values, and upon selection of a field value appropriate page should open up in Frame2.

I have done like this,

function f1() {

var f=document.forms[0]

current = f.CLEDProducts.selectedIndex;

currenttext = f.CLEDProducts.options[current].text;

 

switch(currenttext){

case "- - - - select model - - - -" :

	   alert("Please select one of the products.")

	   return

	   break 

case "" :

	   alert("Please select one of the products.")

     return

     break         

default:

     document.forms[0].LEDProducts.value = "- - - - select model - - - -";

     document.forms[0].SIDMProducts.value = "- - - - select model - - - -";

     document.forms[0].FAXProducts.value = "- - - - select model - - - -";

     document.forms[0].MFPProducts.value = "- - - - select model - - - -";



parent.location.href = "http://ipaddress/db1/framesetname?OpenFrameset&Frame=Frame2&Src="+"/db2/(LookUp)/" + currenttext+"?OpenDocument";

    return

    Break

}}

This function works fine, for the firsttime, if user opens up a application for the first time on browser, and makes selection from a dropdown list box, appropriate page opens up in Frame2, but again if user make another selection from frame3, then the page opens up in a new window, I don’t know why? I want page to be displayed always in frame2 upon selection from a frame3, any idea where am I going wrong?

Thanks

MS

Subject: JS Questions for opening a page in a window

I don’t understand why you’re throwing the frameset away. Make the URL call line look like this:

window.top.document.frames[‘Frame2’].location.href = “http://ipaddress/db2/(LookUp)/” + currenttext+“?OpenDocument”;

That should leave the current frameset in place and load the new document into Frame2.

Subject: RE: JS Questions for opening a page in a window

Thanks for your reply.

I tried this line,

window.top.document.frames[‘Content’].location.href = “http://ipaddress/db2.nsf/(LookUp)/” + currenttext+“?OpenDocument”

Upon selection of a field value from a dropdown list box, it does not give any error, but at the same time, i don’t see any page displayed in frame2.

Any suggestions?

MS

Subject: RE: JS Questions for opening a page in a window

if your frame is named Frame2 then assign your URL to that frame from frame1 or frame3 as follows:

window.parent.Frame2.location.href = yourURL ;

Subject: RE: JS Questions for opening a page in a window

And that’s where part of the problem may lie. To which HTML document does Frame2 belong? Does it belong to the parent of the current window? Does it belong to the _top window? Does it belong to the parent of the current parent, but not yet at the _top level? You could go to the _top and recursively go through all frames to find the frame you’re looking for if you have to do it programmatically, but a better idea would be to view the HTML source of the top frame and work your way down.