I have the following HTML:
<a href="https://datasite.com/data/?search=Datapoints+3-4%3B+Datapoints+4-5&version="
onclick="location.href=this.href + selectedVersion; return false;">Datapoints 3-4; Datapoints 4-5</a>
A <select> tag returns a string for “selectedVersion”.
This is working. I need to add another OPTIONAL parameter to the url when a CheckBox is checked.
I added an <input type=”checkbox” onclick=”printClick()”> which returns a string for “printableVersion”
var printableVersion;
function printClick() {
var checkBox = document.getElementById("printCheckbox");
if (checkBox.checked == true){
printableVersion = "&interface=print";
} else {
printableVersion = "";
}
}
</script>
I modified the href as follows:
<a href="https://datasite.com/data/?search=Datapoints+3-4%3B+Datapoints+4-5"
onclick="location.href=this.href + printableVersion + "&version=" + selectedVersion; return false;">Datapoints 3-4; Datapoints 4-5</a>
But neither parameter are added. On this site, I can only use Javascript, not JQuery, ajax, etc.