Access denied tying to submit form with JS?

N

Noozer

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
task?

Thx!

<html>
<head></head>

<body>

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

<form name="form2" id="form2" method="post" action="test.htm"
style="display:none;">
<input type="file" name="file1" id="file1">
</form>

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top