Forum Moderators: open

Message Too Old, No Replies

button click -> follow link OR link -> form submit?

         

partha

1:59 am on Mar 13, 2005 (gmt 0)

10+ Year Member



Is there someway in javascript to EITHER

- make clicking a button just follow a regular link?

OR

- make a clicking a link submit a form?

Bernard Marx

2:08 am on Mar 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Q1:
<input type="button" value="go" onclick="location.href='page1.htm'">

Q2:
<a href="javascript:document.forms.myForm.submit()">submit</a>

Not good, because they both rely on Javascript.

Rambo Tribble

3:11 am on Mar 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Funny that:
<a href="#"><button>Button in link</button></a>
doesn't work in IE.

A possible work-around, but a bit of a kludge, is to absolutely position the button, then give the anchor a block display of appropriate dimensions and absolutely position it over the button.

Update: just tried that last idea, and it worked, but just some of the time.