![]() |
| ||
| Add extra images Hi, I m new to JavaScript. And I have a webpage where a user can upload 5 images. so I have five input tags, but I want to give him add extra image option,when a user hit add extra image a new input tag appeare. how can I do that using Javascript? Thanks in advance. |
| ||
| Re: Add extra images Absolutely function addInput(parentID)So if you have a form such as <form action="something.php" method="POST" enctype="multipart/form-data" id='imagesForm'>You would have something along this lines <input type="button" onclick="addInput('imagesForm')" value="Upload Another" /> |
| ||
| Re: Add extra images thanks for your reply. I ve tried your solution but the function gives an error, the error message point to this line document.getElementByID(parentID).appendChild(newInput); any hint ? |
| ||
| Re: Add extra images whoops, sorry, lowercase d, document.getElementById(parentID).appendChild(newInput); |
| ||
| Re: Add extra images thanks its working now. the result that I want should be like this <tr>I m reading some tutorials now, to get the code above i ve treid so far this function addInput(parentID)I can't get the code run, but I m working on this, any help well be approciated :). |
| ||
| Re: Add extra images You might want to use a bit more descriptive names. Also, it's not working because you aren't first appending ca (the td) to anything. You must first append the new row (r) to t(parent) then append ca to r, and so on. |
| ||
| Re: Add extra images Quote:
t.appendChild(r);I did this and I got nothing? |
| ||
| Re: Add extra images I'm not entirely sure what the extra TD is for but this is what it should look like function addInput(parentID) |
| ||
| Re: Add extra images Thanks, It's working on opera and FF but not in IE7, do you know why? and thanks again for your replies :) |
| ||
| Re: Add extra images this Code work great on FF but not in IE function addInput(parentID) |
| All times are GMT -4. The time now is 4:52 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC