You are here: irt.org | FAQ | JavaScript | Form | Q1696 [ previous next ]
Use the onSubmit event handler to indirectly update the action attribute, for example:
<html>
<head>
<script language="JavaScript"><!--
function gotoURL(formReference){
var newURL = 'http://www.somewhere.com/' + formReference.elements[1].value;
formReference.action = newURL;
}
//--></script>
</head>
<body>
<form method="post" action="" onSubmit="gotoURL()">
<input type="hidden" name="login" value="login">
<input type="text" size="10">
<input type="submit" value="login">
</form>
</body>
</html>