PDA

Click to See Complete Forum and Search --> : Using a Button/Gif to submit a form ?


nmretd
Oct 20th, 2000, 05:54 AM
I am using the following code:

<%
'-- Check if Submit button pushed, if not ignore the entire script
If Request.Form("btnAdd") = "Submit" Then

ASP code goes here!

End If
%>

<!-- HTML FORM -->
<html>

<head>
<title></title>
</head>

<body>
</body>
</html>

However, I don't want to use a button. I want to use a gif which the user can click to submit the form. How do I modify the code (If Request.Form("btnAdd") = "Submit" Then) to check when the click event has taken place so that the ASP code that follows can be executed ?

dndstef
Oct 20th, 2000, 08:52 AM
Well luky for you i have a little code that do the job
real nice and it works on both IE and Netscape.

If you don't mind using javascript!

You can change to which page it goes depending of the
image button you clicked.


<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Add()
{
// alter the action and submit the form
document.Form1.action = "Page.asp";
document.Form1.submit();
}

function Modif()
{
// alter the action and submit the form
document.Form1.action = "Page2.asp";
document.Form1.submit();
}
// -->
</SCRIPT>


</HEAD>
<body bgcolor="FFFFFF">
<Form Method="post" Name="Form1">
<A href="javascript:Add()"><img SRC="Button.gif" WIDTH="103" HEIGHT="34" BORDER="0"></A>
<A href="javascript:Modif()"><img SRC="Button2.gif" WIDTH="103" HEIGHT="34" BORDER="0"></A>
</Form>

</BODY>


If you need help e-mail me at dndlinux@hotmail.com

bye