mardi 7 juillet 2015

view file option window with a menu click

I am using html and J2EE services for creating web application,in my web page i created menu bar. in that menubar, if i click open option then it will show open file window to show file contents in desktop. For this task i'm using this code

<script type="text/javascript">
function performClick(elemId) {
   var elem = document.getElementById(elemId);
   if(elem && document.createEvent) {
      var evt = document.createEvent("MouseEvents");
      evt.initEvent("click", true, false);
      elem.dispatchEvent(evt);
   }
}
</script>
<a href="#" onclick="performClick('theFile');">Open file dialog</a>
<input type="file" id="theFile" />

but it is creating browse button below open option in menu bar instead of clicking open option to display file window. Please send me some code references to do this task

Aucun commentaire:

Enregistrer un commentaire