redefine the action of an href.

T

toufik toufik

Hi,
I've in amy HTML a form that contains 2 inputs, and an href taht has no
action
using javascript (href onclick event) I like to submit the form when the
user clic on the link, (stop teh href default action and replace it by the
submit in the onclic event)
I've tried this code but it doesn't work..
Any help please.


<html>
<title>Parsing Pasword Form Elements</title>
<body>
<script>
function go(xtel)
{
document.forms[0].action="test1.php?tel="+xtel;
document.forms[0].submit();
}
</script>
<form action="test1.php" METHOD="POST" >

<input type="text" name="nom" />
<input type="text" prenom="prenom" />

<a href="" onclick="go('1234');">Link 1</a>

</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top