473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is this the best way to point to different CGI scripts?

JR
Hi. I have a CGI script that will need to call itself an unknown
number of times, to add rows, run queries, etc. At the bottom of the
output that is produced by the script, there are four buttons. I need
one of the buttons to simply be a back button. I have this button
working fine. I need the second and fourth buttons to point to the
current CGI script, but I need the third button to point to a
different CGI script. I need the second, third and fourth buttons to
pass their respective scripts all data entered on the form.

My clients will be using the most recent versions of IE and Netscape.
Is below a workable method of doing this? I will not be able to
actually test this myself until tomorrow. I've looked at the FAQs,
and there are many ways of using <input type...> to point to different
CGI scripts with different buttons, but because I'm using hyperlink
images to call submit, I don't know that the answers I found apply to
this particular problem.

If this isn't a workable method, could someone please provide me with
some code that is workable? Unfortunatley, I'm not a JavaScript guru,
and this is the best up with which I could come (I also tried using
functions, changing the document directly with syntax found on the
FAQs, but to no avail).

Thanks much!

<html>
<head>
<link rel="stylesheet" href="myCSS.css">
<SCRIPT LANGUAGE = "JavaScript" src="myJS.js">
</SCRIPT>
</head>
<body bgcolor=#00CCFF>

<!-- Lots of CGI script code -->

<form name="form1" action="p1.cgi">
<input type="text" name="input">
<br><br>
<a href='javascript:history.back();'
onMouseover="b1.src='i1_on.gif';"
onMouseout="b1.src='i1_off.gif';">
<img SRC="i1_off.gif"></a>

<a href='javascript:document.form1.submit();'
onMouseover="b2.src='i2_on.gif';"
onMouseout="b2.src='i2_off.gif';">
<img SRC="i2_off.gif"></a>

<!-- Change the form location. Will this get the data
on the form, as well as change the location? -->
<a href='javascript: document.form1.action = "p2.cgi";
javascript:document.form1.submit();'
onMouseover="b3.src='i3_on.gif';"
onMouseout="b3.src='i3_off.gif';">
<img SRC="i3_off.gif"></a>

<!-- Change the form location back to its original location. -->
<a href='javascript: document.form1.action = "p1.cgi";
javascript:document.form1.submit();'
onMouseover="b4.src='i4_on.gif';"
onMouseout="b4.src='i4_off.gif';">
<img SRC="i4_off.gif"></a>

</form>
</body>
</html>
Jul 23 '05 #1
2 1664
Ron
JR wrote:
Hi. I have a CGI script that will need to call itself an unknown
number of times, to add rows, run queries, etc. At the bottom of the
output that is produced by the script, there are four buttons. I need
one of the buttons to simply be a back button. I have this button
working fine. I need the second and fourth buttons to point to the
current CGI script, but I need the third button to point to a
different CGI script. I need the second, third and fourth buttons to
pass their respective scripts all data entered on the form.

My clients will be using the most recent versions of IE and Netscape.
Is below a workable method of doing this? I will not be able to
actually test this myself until tomorrow. I've looked at the FAQs,
and there are many ways of using <input type...> to point to different
CGI scripts with different buttons, but because I'm using hyperlink
images to call submit, I don't know that the answers I found apply to
this particular problem.

If this isn't a workable method, could someone please provide me with
some code that is workable? Unfortunatley, I'm not a JavaScript guru,
and this is the best up with which I could come (I also tried using
functions, changing the document directly with syntax found on the
FAQs, but to no avail).

Thanks much!

<html>
<head>
<link rel="stylesheet" href="myCSS.css">
<SCRIPT LANGUAGE = "JavaScript" src="myJS.js">
</SCRIPT>
</head>
<body bgcolor=#00CCFF>

<!-- Lots of CGI script code -->

<form name="form1" action="p1.cgi">
<input type="text" name="input">
<br><br>
<a href='javascript:history.back();'
onMouseover="b1.src='i1_on.gif';"
onMouseout="b1.src='i1_off.gif';">
<img SRC="i1_off.gif"></a>

<a href='javascript:document.form1.submit();'
onMouseover="b2.src='i2_on.gif';"
onMouseout="b2.src='i2_off.gif';">
<img SRC="i2_off.gif"></a>

<!-- Change the form location. Will this get the data
on the form, as well as change the location? -->
<a href='javascript: document.form1.action = "p2.cgi";
javascript:document.form1.submit();'
onMouseover="b3.src='i3_on.gif';"
onMouseout="b3.src='i3_off.gif';">
<img SRC="i3_off.gif"></a>

<!-- Change the form location back to its original location. -->
<a href='javascript: document.form1.action = "p1.cgi";
javascript:document.form1.submit();'
onMouseover="b4.src='i4_on.gif';"
onMouseout="b4.src='i4_off.gif';">
<img SRC="i4_off.gif"></a>

</form>
</body>
</html>

Alter to the following, some typos fixed and a default script type
registered in the header to aid the browser. The "language" attribute is
deprecated in favor of mimetype:

<?xml version="1.0"?>
<?xml-stylesheet href="myCSS.css" type="text/css"?>
<?xml-stylesheet href="#thisStyle" type="text/css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<!-- IE does not support XML stylesheet PIs, and XHTML processors ignore stylesheet links -->
<link rel="stylesheet" href="myCSS.css" type="text/css" />
<script type="text/javascript" src="myJS.js">
</script>
<style id="thisStyle">
<![CDATA[
body {
background-color:#00CCFF
}
]]>
</style>
</head>
<body>

<!-- Lots of CGI script code -->

<form name="form1" action="p1.cgi">
<input type="text" name="input" />
<br /><br />
<a href="javascript:history.back();"
onmouseover="b1.src='i1_on.gif';"
onmouseout="b1.src='i1_off.gif';">
<img src="i1_off.gif" /></a>

<a href="javascript:document.form1.submit();"
onmouseover="b2.src='i2_on.gif';"
onmouseout="b2.src='i2_off.gif';">
<img src="i2_off.gif" /></a>

<!-- Change the form location. Will this get the data
on the form, as well as change the location? -->
<a href="javascript:document.form1.action = 'p2.cgi';document.form1.submit();"
onmouseover="b3.src='i3_on.gif';"
onmouseout="b3.src='i3_off.gif';">
<img src="i3_off.gif" /></a>

<!-- Change the form location back to its original location. -->
<a href="javascript:document.form1.action = 'p1.cgi';document.form1.submit();"
onmouseover="b4.src='i4_on.gif';"
onmouseout="b4.src='i4_off.gif';">
<img src="i4_off.gif" /></a>

</form>
</body>
</html>
Since your clients are using the most recent browsers, I've also updated
the markup to the latest standards. Otherwise, your code should work;
I've had to switch forms like this myself. :)
Jul 23 '05 #2
Thanks for the response and the modifications. I'm very relieved to
know that this method can actually work!

Joe


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JStrummer | last post by:
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my...
7
by: Dave Smithz | last post by:
Hi There, I have taken over someone else's PHP code and am quite new to PHP. I made some changes and have implemented them to a live environment fine so far. However, I now want to setup a...
1
by: Woody | last post by:
I am looking for some examples of how to manage DDL scripts among various versions of a production db and development and testing. I have tried a few things in the past, and it always gets very...
5
by: great_googley_moogley | last post by:
Greetings, I am in the process of installing a SQL database at a customer location. I have determined that there are 3 ways to do this, and I wanted to know which is the best of the 3. 1...
131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
12
by: neodem | last post by:
PHP, and to a lesser degree JSF has become very popular ways to build web applications. What I don't understand, and what I would like you all to comment on, is how these methods are the best way...
7
by: lopezadmin | last post by:
Announcement! Best DB2 Articles was started as a means to collect and share information between IT Professionals who work with DB2 on any platform and in any capacity. I have been working with...
2
by: sabbadin12 | last post by:
Hi, I'm going to work on an application that uses a postgreSQL database so that it can uses SQLServer 2005. I think I solved most problems on the programming side, but I still have some doubts...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.