Results 1 to 2 of 2

Thread: Using a Button/Gif to submit a form ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213
    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 ?

  2. #2
    Lively Member
    Join Date
    May 2000
    Posts
    67

    Post Found it this week

    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.

    Code:
    <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
    If possible please provide codes.
    Process by example is the best way to learn.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width