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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button as a hypertext link - formatting problems.

Status
Not open for further replies.

ajefferies

Programmer
Nov 23, 2000
4
GB
This seems like a very simple question. I want to turn a link into a button. The link points to myUrl, where myUrl contains form parameters eg. The link:
Code:
<br>
<a href=&quot;myUrl&quot;>Go!</a>
<br>
works no problem. My first attempt at a button:
Code:
<input type=&quot;button&quot; value=&quot;Go!&quot; onclick=&quot;window.location.href='myUrl';&quot;>
does not display in Netscape because it's not in a form. So I put it in an empty form:
Code:
<form>
 <input type=&quot;button&quot; value=&quot;Go!&quot; onclick=&quot;window.location.href='myUrl';&quot;>
</form>
Now I get a big gap (new paragraphs) around the button, which I don't want. So I put it in a table:
Code:
<table>
 <tr>
  <td><form><input type=&quot;button&quot; value=&quot;Go!&quot; onclick=&quot;window.location.href='myUrl';&quot;></form></td>
 </tr>
</table>
The gap's still there, so I move the form (to an illegal postion) :
Code:
<table>
 <form>
  <tr>
   <td><input type=&quot;button&quot; value=&quot;Go!&quot; onclick=&quot;window.location.href='myUrl';&quot;></td>
  </tr>
 </form>
</table>
The gap's gone from IE, but still there in Netscape. At this point I wonder if I'm barking up the wrong tree. I've also tried the <button>..</button> element, but Netscape doesn't like that...

Can anyone help?

Cheers,
Andy.
 
<a href=&quot;Filename-in-my Folder, not the complete URL&quot;> <IMG SRC=&quot;button.gif&quot; hspace=8> <a> Press this button

This button- a GIF-Image - will be surrounded by a 2-pixel frame (&quot;underline&quot; is valid also for images),
not so recommendable.
Better use ImageMaps.
Refer either to Chuck Musciano: HTML..., O´Reilly
or to an example with source text in


G.Hoffmann
 

I was hoping not to use graphics: I'd have to update all my buttons to graphics as different platforms render buttons differently, and I'd have to add more javascript to emulate pressing the button.

Cheers,
 
ajefferies: I don´t use Java, simply HTML - here the action on pressing a button is
fully automatical ! Isn´t &quot;my&quot; code rather short - and you can easily get GIF buttons
from someone else.They are NOT rendered different - I check all pages with three
different browsers. ---G.Hoffmann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top