Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using <FORM> as a menu.

Status
Not open for further replies.

Nithos

Programmer
May 8, 2003
9
US
What i am trying to do is use the submit button of the form to activate a cgi script with predefined values (ie hidden fields). So it will work like a link which will tell my cgi script what files to parse etc..., now the menu uses images and ive figured out how to make imageflips onMouseOver etc... but because this is a FORM it leaves a big space below it, thus the next image menu is far below the previous one.

Here is what im using right now:
<FORM NAME=&quot;form1&quot; METHOD=&quot;post&quot; ACTION=&quot;index.cgi&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;key&quot; VALUE=&quot;blah&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;data&quot; VALUE=&quot;blah2.txt&quot;></FORM>
<IMG BORDER=&quot;0&quot; SRC=&quot;img.gif&quot; onClick=&quot;javascript: document.form1.submit();&quot; onMouseOver=&quot;...&quot; onMouseOut=&quot;...&quot;>

<FORM NAME=&quot;form2&quot; METHOD=&quot;post&quot; ACTION=&quot;index.cgi&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;key&quot; VALUE=&quot;val&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;data&quot; VALUE=&quot;val2.txt&quot;></FORM>
<IMG BORDER=&quot;0&quot; SRC=&quot;img2.gif&quot; onClick=&quot;javascript: document.form2.submit();&quot; onMouseOver=&quot;...&quot; onMouseOut=&quot;...&quot;>

Now the forms are below one another, and the images wont be right below eachother but will have a space inbetween (as far as i can tell as big as the the previous image).

If anyone can help me figure out of how to remove this space would be appreciated. thx. ;)
 
Use a single <form> element and use a <table> to layout your images. Use the table attributes cellspacing and cellpadding to adjust the spacing between the table cells.

-pete
I just can't seem to get back my IntelliSense
 
The problem is that each <FORM> has a margin which gets in the way, you can remove it with CSS thus:

Code:
<FORM STYLE=&quot;margin:0&quot; NAME=&quot;form1&quot; METHOD=&quot;post&quot; ACTION=&quot;index.cgi&quot;>

...and so on...

However, why use forms at all? If all your parameters are fixed you can just put them in the URL thus:

Code:
<A HREF=&quot;index.cgi?key=blah&data=blah2.txt&quot;><IMG BORDER=&quot;0&quot; SRC=&quot;img.gif&quot; onMouseOver=&quot;...&quot; onMouseOut=&quot;...&quot;></A><BR>
<A HREF=&quot;index.cgi?key=val&data=val2.txt&quot;><IMG BORDER=&quot;0&quot; SRC=&quot;img2.gif&quot; onMouseOver=&quot;...&quot; onMouseOut=&quot;...&quot;></A>






-- Chris Hunt
Extra Connections Ltd
 
Thank You for the help

first off to answer the first question i can not used just 1 form b/c the values change and with one form it will take the last set of values by default unfortunetely.

secondly yes i could use the url passing method, and i was doing it at first but this is cleaner so i figured id give it a try

thanx again both of you for the help
will try that margin setting next

--Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top