View Single Post
  #1 (permalink)  
Old March 15th, 2005, 10:11 PM
shenliujun shenliujun is offline
Registered User
 
Join Date: Jul 2004
Location: hf, ah, China.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why the form refuse access?

I want to upload file ,but not use <input id='upfile' type='file'>.I use a button to fire the upfile control's click event.But when I submit form. The error infomation is "The form refuse access".Why? Who give me a correct solution with javascript ?
//script is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm2</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        <script language="javascript">
        function clkHandler(){
           document.all.upFile.click();
           document.Form1.submit(); //error is here
        }
        </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout" >
        <form id="Form2" method="post" runat="server" enctype="multipart/form-data">
            <INPUT id="btn1" onclick="clkHandler();" type="button" value="Button1">
            <INPUT id="upFile" type="file">
        </form>
    </body>
</HTML>

Reply With Quote