I have a table created in html. In the first cell of the table, (1,1), I have added an image. I want this image to function as a button. When I press the image I want to be able to select a photo from computer and add it on the next free cell of the table, if there are free cells left. I am totally new to HTML, CSS and JavaScript and I really searched here for answers, but none of them helped me.
Something more.
I understand that to use an external javascript file, i need to add this in the head or body of html: <script src="nameofjs"></script>
. My question is: in the javascript file, i write all the functions and variables i need for my html code, without that tag? And I only call the one I need in html, right?
So I want to know:
- How to make that image work like a button
- How to use that image button to upload image from computer
- How to make the image be uploaded in the next free cell
- Where in the existent code I need to add the new code.
And this is the code of the table:
<table class="imagestable">
<tr class="firstrow">
<td class="imagebox"><img class="tableimage" src="C:\Users\AncaAlexandra\Desktop\Proiect multimedia\addimageicon.png"></td>
<td class="imagebox">
</td>
<td class="imagebox"></td>
<td class="imagebox"></td>
</tr>
<tr class="secondrow">
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
</tr>
<tr class="thirdrow">
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
</tr>
<tr class="fourthrow">
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
<td class="imagebox"></td>
</tr>
</table>
Thank you very much.
Here is a screenshot of how this looks until now