First of all, I’m a complete newb and this code could be way off so please bare with me.
I’m trying to get the button to have a different hyperlinks based on the text in a table. So if the table answer says Blue, the button click will go to HTML1 and if it says RED then it will go to HTML2. Is this possible? I’ve been running scenarios in my head and this logically makes sense to me, but obviously isn’t working.
<table>
<tr>
<td><strong>TITLE</strong></td>
<td id="colortype" type="text">Blue<br>
</td>
</tr>
</table>
<button class="btn" id="button">Find Colors</button>
<script type="text/javascript">
if (document.getElementById("colortype").textContent == "Blue"){
document.getElementById("button").window.open("HTML1")
}
else (document.getElementById("colortype").textContent = "Red"){
document.getElementById("button").onclick = 'HTML2';
}
</script>