Re: Submit on IMG on NN4-> and IE4->

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Wed, 21 Jun 2000 23:42:33 CDT
 To:  niclas(at)ducati.org
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
try using a form image:

<input type="image" name="first" src="first.gif">
<input type="image" name="second" src="second.gif">

they automatically act as submit buttons. rather than sending name=value 
pairs, they send their clicked coords, so you merely have to test for the 
existance of their coords in the processing script. in asp for example:

IF Request("first.x") <> "" THEN
  'do first stuff
ELSEIF Request("second.x") <> "" THEN
  'do second stuff
END IF

much safer than using javascript... - Cyanide_7

>
>Hi,
>
>a presentation programmer in a project I work in has problems getting a
>Javascript to work on all +4 browsers (NN4 to 6 and IE 4 to 5.5). It's a
>page with a form and two images that when clicked on they shall submit the
>form. A pretty straightforward one it seems but he can't get it to work. He
>does it pretty complicated though, by not using document.form.submit, but
>rather building the whole link and then do a location.href.
>
>So, does anyone has a good script for submitting a form when clicking an
>image?
>
>Oh, I nearly forgot! When clicking on one image, the form should be
>submitted with a variable telling what image he clicked on (like
>"mypage?myaparm1=2&myparam2=3&st=firstimage") but if the other button is
>clicked the form should be submitted with info on that image (like
>"mypage?myaparm1=2&myparam2=3&st=secondimage")
>
>I first thought of using a hidden textbox and let a JAvascript update the
>value of that hidden textbox, but that good at JAvascript I am not :-)
>
>Any suggestions or helping scripts?
>
>BEst regards
>Niclas
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA