Access denied tying to submit form with JS?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

The following javascript code generates an "Access denied" error at the
indicated line.

This sample should allow the user to click "Browse" and choose a file. Once
the user has selected a file the form is automatically submitted. I'm trying
to avoid having seperate browse and submit actions.

Can someone explain why I'm getting the error and how I can accomplish this




  <form name="form1" id="form1" method="post" action="test.htm">
   <input type="button" value="Browse" onclick="return vlu();">

  <form name="form2" id="form2" method="post" action="test.htm"
   <input type="file" name="file1" id="file1">

  <script language="javascript"> <!--
function vlu() {;
 if (form2.file1.value != "") {
  form2.submit();  //*** ERROR HERE

Site Timeline