|
Q1696 How can I update the action attribute of a form to include details from one of the form fields?
irt.org | Knowledge Base | JavaScript | Form | Q1696 [ previous next ]
Q1696 How can I update the action attribute of a form to include details from one of the form fields?
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.