i wanted to use a variable that i manualy inserted in my url
for example the url test.coaching.com?c=1
then i wanted to check if the var c had any value attached to it, if it had i would show a label and a textbox if it hadnt i would hide it
Here is my code so far:
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
function start()
{
var first = getUrlVars()["c"];
if ( first == "")
{
document.getElementById("labeler").style.display = "none";
document.getElementById("emailcoacher").style.display = "none";
}
else
{
document.getElementById("labeler").style.display = "block";
document.getElementById("emailcoacher").style.display = "block";
}
}
The problem is i cant get it to read the variable, is there someting im doing wrong?