javascript - Redirect url if checkboxes are selected -
i have problem redirecting urls after checkboxes selected. using document.location this, doesn´t work in code. i'm trying fix it, without success.
this part of code doesn't work:
function objednat() { var adress = ""; if (document.getelementbyid('boxtarifvolani1').checked == true) { adress += "#tarifvolani1"; } window.location = 'http://www.investcon.webinpage.cz/cz/objednat-tarif-dobijeci-cislo/' + adresa; } i want redirect form, filled selected values. don't know why, document.location doesn't work in code.
this part of code use in formula grabbing hash url.
<script type="text/javascript"> if(window.location.hash) { //set value variable, , remove # var hash_value = window.location.hash.replace('#', ''); if (tarifvolani1 == true) { document.getelementbyid('boxtarifvolani1").checked = true;} .... </script> what doing wrong?
whatever have done right, except, function name wrong case:
- change
getelementbyidgetelementbyid. - change
adresaadress.
code:
function objednat() { var adress = ""; if (document.getelementbyid('boxtarifvolani1').checked == true) { adress += "#tarifvolani1"; } window.location = 'http://www.investcon.webinpage.cz/cz/objednat-tarif-dobijeci-cislo/' + adress; }
Comments
Post a Comment