jeudi 27 août 2015

Can get variable to set on javascript

Trying to make a variable __lc.group dynamic so that the group number is set based on the URL of the page, this is the code I have tried but it doesn't seem to have worked.

Not sure why it wouldn't be working. This is to dynamically set the group variable for a live chat function on site so I can set different operators for differnet pages of the site.

if(window.location.href.indexOf("netball") > -1) {
       __lc.group = 1;
    }
if(window.location.href.indexOf("football") > -1) {
       __lc.group = 5;
    }
if(window.location.href.indexOf("basketball") > -1) {
       __lc.group = 2;
    }
if(window.location.href.indexOf("social") > -1) {
       __lc.group = 3;
    }
if(window.location.href.indexOf("fitness") > -1) {
       __lc.group = 6;
    }
if(window.location.href.indexOf("softball") > -1) {
       __lc.group = 4;
    }
if(window.location.href.indexOf("volleyball") > -1) {
       __lc.group = 4;
    }
if(window.location.href.indexOf("dodgeball") > -1) {
       __lc.group = 4;
    }
if(window.location.href.indexOf("american") > -1) {
       __lc.group = 4;
    }
if(window.location.href.indexOf("ultimate") > -1) {
       __lc.group = 4;
    }

Aucun commentaire:

Enregistrer un commentaire