Menu
I want to see the contents of a formfield by passing the formfield-name to a function. I just can’t seem to get it working.
See code below…
function postThis(fieldName) {
alert(document.myForm.fieldName.value);
}
<form name=”myForm” action=”nextPage.htm”>
<input type=”text” name=”firstname”>
</form>
<a href=”javascript:postThis(‘firstname’);”>show fistname</a>