Change form action through javascript

<FORM name="form1" METHOD="POST" ENCTYPE="multipart/form-data"  ACTION="">
<INPUT TYPE="text"  SIZE="40" id="z" NAME="z" value="zzzz">
   <INPUT TYPE=SUBMIT onclick="return submit();" VALUE="Upload!">
</FORM>

<script language="javascript">
function submit()
{

var img1=document.getElementById("z").value;

document.form1.action = "UploadScript11.asp?value="+img1;
document.form1.submit();

}
</script>