Anchor tag question

I have a form with two input fields and 5 anchored GIFs for buttons.  Each GIF will send me to a different URL.  I want to transfer the data within the fields in the first screen to the new URL when I press the GIF button.  How can I accomplish this?
bkeithmAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
<A href='#' onClick='document.myform.action="URL1.htm";document.myform.submit();return(false);'><IMG src='img1.gif' border='0'></a>

<A href='#' onClick='document.myform.action="URL2.htm";document.myform.submit();return(false);'><IMG src='img2.gif' border='0'></a>

<A href='#' onClick='document.myform.action="URL3.htm";document.myform.submit();return(false);'><IMG src='img3.gif' border='0'></a>

etc
0
 
knightEknightCommented:
Try this:

<A href='#' onClick='document.myform.action="URL1.htm";document.myform.submit();return(false);'><IMG src='img1.gif' border='0'></a>

<A href='#' onClick='document.myform.action="URL2.htm";document.myform.submit();return(false);'><IMG src='img2.gif' border='0'></a>

<A href='#' onClick='document.myform.action="URL3.htm";document.myform.submit();return(false);'><IMG src='img3.gif' border='0'></a>

etc

____________________________________________________________________________________________________________________________________
0
 
Jan LouwerensSoftware EngineerCommented:
even better than <a href="#"...> would be to use <a href="javascript:void()"...> because it won't jump to the top of the page when you click it...
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
knightEknightCommented:
... that is why I return false in the onClick -- so that it won't jump.  Therefore, '#' is no worse than 'javascript:void();'  or even 'javascript:;'
0
 
Jan LouwerensSoftware EngineerCommented:
I did not know that! You learn something new everyday, huh? Thanks for the new knowledge, knightEknight  =)
0
 
knightEknightCommented:
Yep!  That is the purpose of returning true or false from an anchor.  You could even use href='cnn.com' and as long as you return false, you will never actually go to cnn.com .  It also allows you to do things like this:

<A href='www.cnn.com' onClick='return(confirm("Are you sure?"));'>Click Me!</a>
0
 
bkeithmAuthor Commented:
Thanks knightEknight.  The points are yours. Sorry about the tardiness of the acceptance.  I've been out-ot-pocket for a few days.  
0
 
knightEknightCommented:
Glad to help!
0
All Courses

From novice to tech pro — start learning today.