PDA

Click to See Complete Forum and Search --> : Issue using JavaScript to open pages in multiple frames [Resolved]


Phredd
Jun 22nd, 2005, 02:03 PM
I'm needing to update two seperate frames when a user clicks on one link. I have it working fine so long as neither of the two frames are the frame where the link is. If I try to update the current frame, nothing happens. This happens if I specify the frame name, or use "_self".

The current frame is leftNavBottom, which will not open the new window. However, the <Product>_faq.html will open in the mainPage frame. Also, faqMenu.jsp will open in any other frame besides leftNavBottom.

I've tried everything I can think of, all have the same results. Here's a couple of things I've tried at different points:

function showProd(FolderId,Product)
{
window.open("../jsp/faqMenu.jsp?FolderId=" + FolderId + "&StyleSheet=../xsl/faqMenu.xsl&Product=" + Product,"leftNavBottom");
window.open("../customhtml/" + Product + "_faq.html","mainPage");
}

function showProd(FolderId,Product)
{
top.window.frames.leftNavBottom.location.href="../jsp/faqMenu.jsp?FolderId=" + FolderId + "&StyleSheet=../xsl/faqMenu.xsl&Product=" + Product;
top.window.frames.mainPage.location.href="../customhtml/" + Product + "_faq.html";
}

I can get faqMenu.jsp to open up in the leftNavBottom frame using the <a> <href=></a> syntax, but that won't open both pages at the same time.

If anyone has any suggestions, I'd be much appreciative.
-Phredd, who is very :confused:.

Phredd
Jun 22nd, 2005, 03:57 PM
Found the answer.

Changed code from:
function showProd(FolderId,Product)
{
window.open("../customjsp/faqMenuList.jsp?FolderId=" + FolderId + "&StyleSheet=../xsl/faqMenu.xsl&Product=" + Product,"leftNavBottom");
window.open("../customhtml/" + Product + "_faq.html","mainPage");
}

to:

function showProd(FolderId,Product)
{
window.open("../customjsp/faqMenuList.jsp?FolderId=" + FolderId + "&StyleSheet=../xsl/faqMenu.xsl&Product=" + Product,"leftNavBottom");
window.open("../customhtml/" + Product + "_faq.html","mainPage");
return false;
}


Changed href from:
<a href="javascript:void(0);" onclick="javascript:showProd('Test1','Test2');">Test</a>

to:
<a href="javascript:void(0);" onclick="javascript:return showProd('Test1','Test2');">Test</a>

Evidently, since I was opening the page into the same frame, it did open. Then the href took back over, and opened the original page back into the frame. By returning "false" back to the onclick, it stopped the href from reopening the original page.

The above information may not be technically accurate, but the jist is there.

-Phredd, who figured he'd post the solution in case anyone else happens across this problem.