473,326 Members | 2,128 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,326 software developers and data experts.

one form two buttons(well three)

Hi all

Was wondering if someone could show me how I can use javascript to submit a
form using three separate buttons that would cause the forms action="" to
hold different values?
Poko
Oct 23 '05 #1
2 1586
"Poko" <po**@shaw.ca> wrote in message
news:q4U6f.282912$tl2.154376@pd7tw3no...
Hi all

Was wondering if someone could show me how I can use javascript to submit a form using three separate buttons that would cause the forms action="" to
hold different values?
Poko


Will this help? Watch for word-wrap.

<html>
<head>
<title>3actions.htm</title>
<script type="text/javascript">
function submits(what) {
document.form1.action += "?" + what;
document.form1.submit();
}
</script>
</head>
<body>
<form action="3actions.htm" method="post" name="form1">
<input type="button" value="1" onclick="submits(1)">
<input type="button" value="2" onclick="submits(2)">
<input type="button" value="3" onclick="submits(3)">
</form>
</body>
</html>
Oct 23 '05 #2
McKirahan wrote on 24 okt 2005 in comp.lang.javascript:
"Poko" <po**@shaw.ca> wrote in message
news:q4U6f.282912$tl2.154376@pd7tw3no...
Hi all

Was wondering if someone could show me how I can use javascript to
submit

a
form using three separate buttons that would cause the forms
action="" to hold different values?
Poko


Will this help? Watch for word-wrap.

<html>
<head>
<title>3actions.htm</title>
<script type="text/javascript">
function submits(what) {
document.form1.action += "?" + what;
document.form1.submit();
}
</script>
</head>
<body>
<form action="3actions.htm" method="post" name="form1">
<input type="button" value="1" onclick="submits(1)">
<input type="button" value="2" onclick="submits(2)">
<input type="button" value="3" onclick="submits(3)">
</form>
</body>
</html>


No javascript needed, use the [default] 'Get' method:

<form action="3actions.htm" method="get">
<input type="submit" value="do1" name="theAction">
<input type="submit" value="do2" name="theAction">
<input type="submit" value="do3" name="theAction">
</form>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #3

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

Similar topics

1
by: Jeremy Langworthy | last post by:
Hi I have a dynamicly generated form (well the elements are at least) that looks something like this: while( not end of returned records): <input name="plan_id" type="checkbox" id=""...
8
by: L Major | last post by:
Hi Unfortunately, I am limited to using tables for part of my current project. I have a form that spans across a number of TR and TD in the shape of checkboxes. Doctype is XHTML 1.0...
1
by: Brian | last post by:
I'm thinking of creating a contact form where the user can either send their message immediately or preview the message first. So far, I cannot think of a way to make it happen. My form mail...
2
by: Jean | last post by:
I have two form and I want to display in the first form some of the info from the second one. Here is how I tried to do it: <<<<ok button of form2>>>>> Dim Myform1 As New Form1...
5
by: D Witherspoon | last post by:
I use the following code to open up a form. ------------------------------------------------------- If fImage Is Nothing Then fImage = New frmImage End If fImage.Show()
1
by: crawlerxp | last post by:
Does anyone know what is the problem here: I have installed IIS and asp.net 1.1 on windows XP SP1. asp.net 1.1 is a production not development version I downloaded from ms site. Welll this is...
3
by: stacey | last post by:
Hi all, I have a quick question about form classes. I am following this tutorial: http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html Basically, it is a login...
4
by: celoftis | last post by:
I've got html page with has a fixed height - there are five buttons on the page. The page has a fixed, known height - but the width can change. The five buttons should be arranged on the page as...
1
by: tash.robinson | last post by:
I have a modal form called like: myKeyboard.ShowDialog(Me) If myKeyboard.DialogResult = Windows.Forms.DialogResult.OK Then result = myKeyboard.txtEntry.Text Else result = defaulttext End If
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.