Im trying to create a javascript function that sets the value of one input, when another one is changed. Heres my javascript (that isnt working):
<script type="text/javascript">
function addvalue(formname)
{
document.formname.elements.description.value = "filgerng";
}
</script>
And here are my two elements:
<input id="firstfile" type="file" class="fileupload" name="files[]" size=
"80" onchange="addvalue(this.form)" />
<input id="firstdescription" type="text" name="description" size="50"
/>
Any ideas?
You have an error in your function at:
Actually,
elementsis an array, use :Plus, try to avoid
this.form. This is not well handled by every browsers.You’d better use a