Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML DOM to create file upload button(Browse)

 
Ketan Joshi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using the following javascript to insert a file upload button or a browse button when the user clicks a link on the same page

Here is the script
<script language='JavaScript'>
var i=1;
function createBrowse(){
var browse=document.createElement("<INPUT TYPE='file' NAME=i>");
var brk=document.createElement("<br>");
document.body.insertBefore(brk);
document.body.insertBefore(browse);
i++;
}
</script>



The body contains the following code
<a href='javascript:createBrowse()' style="text-decoration:none">Upload More</a>


This code helps me create browse button on the fly.

However the method that I use insertBefore() is a xml DOM node method

I came to know abt this method from some source code

I am unsure as to how to use this method to create these browse buttons where I want

My specific requirement is that there is a table and on clicking upload more, new row should get created with the table data being the browse button

Please let me know how to achieve this

Thanks
ketan
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look into insertRow() and insertCell()

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic