hi im new to scripting and looked everywhere in multiple forum websites to try and find out if this is possible with just html/js as its the only scripting languages i kind of understand
what im after is having 2 drop down boxes the user can select to download a file to the drop down colour and size here is my html code,i have been on w3schools.com
<!--Table Header--><table border="1" style="width:100%;text-align:center;"><tr><th><b><u>File Name</u></b></th><th><b><u>Image Size</u></b></th> <th><b><u>File Size</u></b></th><th><b><u>colour</u></b></th><th><b><u>Preview</u></b></th><th><b><u>Download</u></b></th></tr><!--Table Content--><tr>I<td>HouseDoorKeyS30x30.png</td><td><select id="ISize"><option id="30x30" value="30x30">30x30</option><option id="40x40" value="40x40">40x40</option><option id="50x50" value="50x50">50x50</option><option id="60x60" value="60x60">60x60</option></select></td> <td>1.53 KB</td><td><select id="Icolour"><option id="Silver" value="Silver">Silver</option><option id="Gold" value="Gold">Gold</option><option id="Chrome" value="Chrome">Chrome</option></select></td><td><img src="Silver Key.png"></td><td><button onclick="ChangeDLI.js">Download</button></td></tr></table>
and here is my js code i just dont understand how to get it to work my external js file is called ChangeDLI.js
function ChangeDLI() { if(document.getElementById("Isize").value=="30x30" && document.getElementById("Icolour").value=="Silver") { document.getElementById("IDownload").href="SilverKey30x30.png" } if(document.getElementById("Isize").value=="40x40" && document.getElementById("Icolour").value=="Silver") { document.getElementById("IDownload").href="SilverKey40x40.png" } if(document.getElementById("Isize").value=="50x50" && document.getElementById("Icolour").value=="Silver") { document.getElementById("IDownload").href="SilverKey50x50.png" } if(document.getElementById("Isize").value=="60x60" && document.getElementById("Icolour").value=="Silver") { document.getElementById("IDownload").href="SilverKey60x60.png" } }
i dont know if this is anywhere close to what im after as when i click my button nothing happens but hopefully some super guy/girl can point me in the right direction :) also could some please let me know how to make the button download the file instead of having to right click it and save as