ficken
asked on
in need of pulldown menu script
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.inde xOf('MSIE' ) !=-1 && navigator.appVersion.index Of('3.')
!=-1);
function goThere(selidx) {
Opt = document.forms[0].sel.opti ons[selidx ].value;
tgt = Opt.substring(0,Opt.indexO f(','));
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(selected Index);sel ectedIndex =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],feedb ack.html"> Feedback
</SELECT>
<SCRIPT LANGUAGE="JavaScript">
<!-- // hide from old browsers
if (MSIE3) document.write('<INPUT TYPE="BUTTON" VALUE= "Go!" ONLICK="goThere(this.form. sel.select edIndex)"> ');
// end hide -->
</SCRIPT>
<NOSCRIPT>
<INPUT TYPE="SUBMIT" VALUE="Go!">
</NOSCRIPT>
</FORM>
</BODY>
</HTML>
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.inde
!=-1);
function goThere(selidx) {
Opt = document.forms[0].sel.opti
tgt = Opt.substring(0,Opt.indexO
loc = Opt.substring(Opt.indexOf(
eval(tgt + '.location ="' + loc + '"');
}
// end hide -->
</SCRIPT>
</HEAD>
<BODY>
<FORM ACTION="/cgi-bin/goscript.
<SCRIPT LANGUAGE="JavaScript">
<!-- // hide from old browsers
document.write('<SELECT NAME="sel"');
if (MSIE3) document.write('>');
else {
document.write(' ONCHANGE="goThere(selected
document.write('<OPTION VALUE="self,self.location.
}
// end hide -->
</SCRIPT>
<NOSCRIPT>
<SELECT>
</NOSCRIPT>
<OPTION VALUE="top,http://www.netscape.com">Netscape
<OPTION VALUE="self,feedback.html"
<OPTION VALUE="top.frames[0],feedb
</SELECT>
<SCRIPT LANGUAGE="JavaScript">
<!-- // hide from old browsers
if (MSIE3) document.write('<INPUT TYPE="BUTTON" VALUE= "Go!" ONLICK="goThere(this.form.
// end hide -->
</SCRIPT>
<NOSCRIPT>
<INPUT TYPE="SUBMIT" VALUE="Go!">
</NOSCRIPT>
</FORM>
</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry, looked again at the script above it was wrong
(too much copying and pasting),
try this...
#!/www/servers/common/perl
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