contents of form field

admin

Administrator
Staff member
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=http://www.webdeveloper.com/forum/archive/index.php/"javascript:postThis('firstname');">show fistname</a>
 
Back
Top