Reputation: 18103
I really want to have a link, such as, "Save" that act the same way as a input type submit button?
I never figured out how to do this, is it even possible? How?
Upvotes: 5
Views: 10878
Reputation: 27600
Random example:
Form:
<form id="myform" name="myform" method="post" action="something.php">
Submit link:
<a href="javascript:postform()">Click!</a>
JavaScript:
<script language="JavaScript" type="text/javascript">
function postform( )
{
document.getElementById('myform').submit() ;
}
</script>
Upvotes: 2
Reputation: 29856
its possible using javascript. like this:
<form name="theform" ...>
<a href="javascript:document.theForm.submit();">Save</a>
</form>
but i would suggest to style a button to look as a link, so you have no problem with clients without javascript
Upvotes: 2
Reputation:
You can just style the button to look like a link:
input[type="submit"]
{
background: transparent;
text-decoration: underline;
cursor: pointer;
}
Upvotes: 8