I have two web pages A and B. Webpage A contains some radio buttons. I just want that if the user selects any of the radio button, webpage B should be opened.
Can anyone help me regarding what should I try to do this?
I have two web pages A and B. Webpage A contains some radio buttons. I just want that if the user selects any of the radio button, webpage B should be opened.
Can anyone help me regarding what should I try to do this?
Your need to add the onclick
attribute to your radiobuttons in this way:
<input type='radio' onclick='functionCalled()' />
Then under the radio buttons add:
<script>
function functionCalled() {
window.open(url); //if you want to open in new window
window.location = url; //if you want to redirect
}
</script>
HTML alone is not enough. You will need to start learning JavaScript (and preferably jQuery as well).
Assuming you have jQuery:
<input type="radio" name="mything" value="1"/>
<input type="radio" name="mything" value="0"/>
$('input:radio[name="mything"]').change(
function(){
if ($(this).is(':checked') && $(this).val() == '1') {
window.location = "http://www.yoururl.com";
}
else{
window.location = "http://www.yourotherurl.com";
}
});
Javascript redirect: How to redirect to another webpage in JavaScript/jQuery?
Radio Button selected: Jquery If radio button is checked
Try this:
<input type="radio" onchange="window.location.replace('URL_OF_WEBSITE')">