[Javascript] To use "click" method of Input Type File control

shanmuga priya pspriya2001 at yahoo.co.in
Tue Jun 18 02:05:06 CDT 2002


Hi,
i have a situation where i would like to use the
"click()" method of Input Type 'File' control.
The steps followed by me.  
1.	I put a Input type File control and i made it
invisible
2.	I put one Button control and one Text control. 
3.	I am calling the "click()" method of File control
from the OnClick event of the button control.
4.	Then i am assigning the File value to the Text
control.
5.	I put one more Button control.
6.	Then Onclick event of this button i am calling
"SubmitPage" function to submit the page to an target
asp file.

When i run this page and on clicking the Send button i
am getting an error as "Access is denied". 
If u find the solution for this please clarify me. 
Regards 
PSNathan. 


The code used by me :

<%@ Language=VBScript %>
<%
Option Explicit
%>
<HTML>
 <HEAD>
  <SCRIPT LANGUAGE="Javascript">
   function FileClick()
   { 
    document.frmSample.Text1.value =
document.frmSample.File1.value;
   }
   
   function SubmitPage()
   {
    document.frmSample.action = "Target.ASP"
    document.frmSample.submit();   
   }   
  </SCRIPT>
 </HEAD>
 <BODY>
  <FORM Name="frmSample" Method="post" Action="">   
   <INPUT Type="file" Name="File1"
Style="Display:none">   
   <INPUT Type="text" Name="Text1" Value="">      
   <Input type="button" name="But1" value="Open"
OnClick=Javascript:File1.click();FileClick()>
   <INPUT Type="button" Name="But2" Value="Send"
OnClick="SubmitPage()">
  </FORM>
 </BODY>
</HTML>

________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
       visit http://in.autos.yahoo.com



More information about the Javascript mailing list