Creating Conditional Statement Based On Page URL

May 24, 2013 in answer

0 votes, 0.00 avg. rating (0% score)

ANSWER:

you can try:

var str = window.location; // get the current URL;
var el; // cache element;
if(srt.indexOf('lights-out') > -1)
    el = document.getElementById("input_1_11");
} else if(srt.indexOf('growth-web') > -1) 
    el document.getElementById("input_2_6");
 else if(srt.indexOf('growth-iphone') > -1) 
    el = document.getElementById("input_3_6");


if(el)
    el.value = latitude;

JayMoretti from http://stackoverflow.com/questions/16727965