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:

  1. change getelementbyid getelementbyid.
  2. change adresa adress.

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

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -