Google Answers Logo
View Question
 
Q: Some JavaScript Help - Opening two CGI's with one <A> tag ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Some JavaScript Help - Opening two CGI's with one <A> tag
Category: Computers > Internet
Asked by: davidfilmer-ga
List Price: $10.00
Posted: 17 Jun 2003 01:46 PDT
Expires: 17 Jul 2003 01:46 PDT
Question ID: 218242
Greetings. I'm Webmaster for a Boy Scout Troop website
(www.troop606.org). I'm a fairly compitent Perl hack, but I'm weak on
the JavaScript side.

My site is composed of a set of three frames: 'banner', 'menu', and
'main'.  Currently, only 'main' ever changes.

My 'menu' frame loads "menu.cgi," a simple CGI.pm Perl script.  I
dislike my 'menu' frame for two reasons:  one, it's butt-ugly, and,
two, it doesn't give any indication of the currenly-selected page.

So I've written another menu .cgi program that I like MUCH better,
which simulates folder tabs and indicates the current page.  Have a
look at these examples:
   http://troop606.org/cgi-bin/menu2.cgi?content=Home
   http://troop606.org/cgi-bin/menu2.cgi?content=Photos
   http://troop606.org/cgi-bin/menu2.cgi?content=About

Now, all I need to do is to replace the menu frame (menu.cgi) with the
new-and-improved menu (menu2.cgi).

But, to do that, the <a> links in menu2.cgi need to be replaced with a
little bit of javascript to open two .cgi programs in two frames -
(one) to reload the menu.cgi in the 'menu' frame and (two) to open the
designated target in the 'main' frame.  And I'm not sure how to do
that.

The answer seems very simple.  I found some code at
http://javascript.internet.com/navigation/load-two-frames.html, which
ALMOST does what I want, but it loads into a new window.  My clock
tells me that's it's 1:43 am localtime and I'm too tired to figure it
out, so I pose the question to those who know JavaScript much better
than I.

All of my code is available from "view source" on my web-links, so I
won't bother to replicate it here.  A suitable answer would specify
the syntax of the <a> links in menuX.cgi as well as any bit of code
that belongs in the HEAD section of any document to make this work.

Tnanks!
Answer  
Subject: Re: Some JavaScript Help - Opening two CGI's with one <A> tag
Answered By: hammer-ga on 17 Jun 2003 04:53 PDT
Rated:5 out of 5 stars
 
Hi DavidFilmer,

This script allows you to set the location of two frames at one time
from an anchor <A>:

<script language="JavaScript"><!--
function functionName(fileName1,fileName2) {
    parent.menu.location.href = fileName1;
    parent.main.location.href = fileName2;
}
//--></script>

<a href="javascript:functionname('cgi-bin/menu.cgi','cgi-bin/home.cgi')">Go</a>

Additional Resources:
IRT.org has an excellent JavaScript FAQ. Actually they have a whole
bunch of excellent FAQs!

IRT.org
Q88 How can I change the location of two frames using a simple '<a
href="">'?
http://developer.irt.org/script/88.htm

IRT.org
http://www.irt.org

IRT JavaScript FAQ
http://developer.irt.org/script/script.htm


Good luck with your website!

- Hammer
davidfilmer-ga rated this answer:5 out of 5 stars
The answer was right on-target and did EXACTLY what I needed.  Visit
troop606.com if you'd like to see your assistance in action.

And the irt.org website is FANTASTIC!

Thanks!!!

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy