I been googling this question for sometime and I've found so many answers however I am STILL unable to get my code to function properly.
Here is my issue...
I have several radio buttons (see code below)
<form class="prov" id="province">
<label>
<input type="radio" id="on" name="prov" value="on" />
<img src="on.png" width="164px" height="51px">
</label>
<label>
<input type="radio" id="nl" name="prov" value="nl" />
<img src="nl.png" width="297px" height="47px">
</label>
<label>
<input type="radio" id="ns" name="prov" value="ns" />
<img src="ns.png" width="253px" height="46px">
</label>
<label>
<input type="radio" id="mb" name="prov" value="mb" />
<img src="mb.png" width="197px" height="44px">
</label>
<label>
<input type="radio" id="sk" name="prov" value="sk" />
<img src="sk.png" width="311px" height="44px">
</label>
<label>
<input type="radio" id="ab" name="prov" value="ab" />
<img src="ab.png" width="165px" height="48px">
</label>
<label>
<input type="radio" id="bc" name="prov" value="bc" />
<img src="bc.png" width="351px" height="42px">
</label>
<button id="select" onclick="provSelect()">Submit</button>
</form>
What I need this to do is once one of the "buttons" are selected and they click on the #select button on the bottom, I want them to be redirected to a specific page. Each radio button would have them directed to a different page.
Here is my Javascript.
function provSelect() {
var provMain = document.getElementById('province').prov;
var provinceMain;
for(var i = 0; i < provMain.length; i++) {
if(provMain[i].checked == 'on') {
window.location = "test.html";
}
}
}
I will be honest, I had this working for IE however it refused to work in chrome no matter what I did. I played around with it alot and now the code doesnt work at all..
I mainly need this to work in IE and Chrome however if chrome is the only option I'd rather that.
Any help would be greatly appreciated.
Thank you!