Solved

in need of pulldown menu script

Posted on 1998-06-26
2
196 Views
Last Modified: 2010-03-04
I am in need of a good perl cgi script that will run a pulldown menu script on my pages. I have a javascript running for this that includes an alternate option to call up a cgi script for those who  have non-javascript enabled browsers. Now I need a perl script that will perform the function. I would also like to be able to store the selectable URLS for the menu in a separate SSI file so that I can update the script without having to edit all of my web pages....

here is the script I have that the perl script needs to interface with:

  <HTML>
      <HEAD>
      <TITLE>PulldownNGo</TITLE>
      <SCRIPT LANGUAGE="JavaScript">
      <!-- // hide from old browsers
      var MSIE3 = (navigator.appVersion.indexOf('MSIE') !=-1 && navigator.appVersion.indexOf('3.')
      !=-1);
      function goThere(selidx) {
         Opt = document.forms[0].sel.options[selidx].value;
         tgt = Opt.substring(0,Opt.indexOf(','));
         loc = Opt.substring(Opt.indexOf(',')+1);
         eval(tgt + '.location ="' + loc + '"');
      }
      // end hide -->
      </SCRIPT>
      </HEAD>
      <BODY>
      <FORM ACTION="/cgi-bin/goscript.pl">
      <SCRIPT LANGUAGE="JavaScript">
      <!-- // hide from old browsers
      document.write('<SELECT NAME="sel"');
      if (MSIE3) document.write('>');
      else {
         document.write(' ONCHANGE="goThere(selectedIndex);selectedIndex=0;">');
         document.write('<OPTION VALUE="self,self.location.href">--- Select a site ---');
      }
      // end hide -->
      </SCRIPT>
      <NOSCRIPT>
      <SELECT>
      </NOSCRIPT>
      <OPTION VALUE="top,http://www.netscape.com">Netscape
      <OPTION VALUE="self,feedback.html">Feedback
      <OPTION VALUE="top.frames[0],feedback.html">Feedback
      </SELECT>
      <SCRIPT LANGUAGE="JavaScript">
      <!-- // hide from old browsers
      if (MSIE3) document.write('<INPUT TYPE="BUTTON" VALUE= "Go!" ONLICK="goThere(this.form.sel.selectedIndex)">');
      // end hide -->
      </SCRIPT>
      <NOSCRIPT>
      <INPUT TYPE="SUBMIT" VALUE="Go!">
      </NOSCRIPT>
      </FORM>
      </BODY>
      </HTML>

0
Comment
Question by:ficken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
tpryor earned 200 total points
ID: 1208230
easy to redirect like this...

#!/www/servers/common/perl5

push(@INC, split(':', $ENV{"PATH"}));
require "cgi-lib.pl";
&ReadParse;

$me = &MyURL();


print "Location: $file\n\n";

###################################

just pass the path to the cgi script.
if you need to pass more than one var with a selection
just concat the vars with delimiter and split them up inside the cgi.
EX:
In HTML file
value="var|path"

In cgi file
($var, $path) = split(/\|/, $form_input);

GL,
t

0
 
LVL 2

Expert Comment

by:tpryor
ID: 1208231
BTW keeping a seperate file for the menu is a good idea. It would simply be all html, no need to change your code.

sorry, looked again at the script above it was wrong
(too much copying and pasting),
try this...



#!/www/servers/common/perl5

require "cgi-lib.pl"; # library that will help with cgi
&ReadParse;               # function in cgi-lib.pl to grab form data
      
$file = $in{"file"}; # file ($in{"file"}) would be the name of
                               # your pull down menu. This will grab the
                               # html file associated with the menu
                               # selection and place it in the $file var.

print "Location: $file\n\n";
# this will open the html file in $file

###################################

GL,
t
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Shell script to bind my job to half the number of vCPUs in Solaris 8 123
add a syntax to a csv file 8 99
Perl script to delete older files 6 94
perl syntax 3 36
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question