This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes HTML DOM to  create   file upload button(Browse) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML DOM to  create   file upload button(Browse) " Watch "HTML DOM to  create   file upload button(Browse) " New topic
Author

HTML DOM to create file upload button(Browse)

Ketan Joshi
Ranch Hand

Joined: Oct 09, 2005
Posts: 66
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
look into insertRow() and insertCell()

Eric
 
 
subject: HTML DOM to create file upload button(Browse)
 
Similar Threads
Create dynamic input text type in a table
Adding a row to a HTML table on-the-fly
Help me to have a sortable table in my html profile!
createElement()
Add a Table Row