Given the following form:
<form id="test" action="http://www.example.com/" method="post">
<input type="hidden" name="action" value="example">
</form>
What will document.forms.test.action and document.forms.test.getAttribute('action') be?
The former is the hidden field, the latter is the form's action.
The problem was that I couldn't change the HTML and had to pass the form to somebody else's javascript which assumed that form.action would work. After a bit of head scratching, I found the workaround isn't too painful:
var form = new Object();
form.action = test.getAttribute('action');
some_function(form);
test.setAttribute('action', form.action);
Javascript woes 0 Comments More | Login | Reply /