tags:

views:

43

answers:

1

Hi all, I would like to insert a parameter value (AS A NUMBER) found the url into my javascript code.. So basically i have the following url www.rene-zamm.com/mp-dthanks.asp?gglid=123123123

Now i have the following javascript code in the same page and i want that number in the url to be visible also in the javascript code where i have written querydata..:

      <script type="text/javascript">


function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
try {
var querydata = gup("gglid");
var gwoTracker=_gat._getTracker("UA-1639156-3");
gwoTracker._trackPageview("/" + **querydata** + "/goal");
alert(querydata);
}catch(err){}

</script>

For some reason the querydata is showing as text and not as number.. please help

A: 

If you're sure that querydata is going to be a number, just use parseInt(querydata) and it will return a number, integer to be exact

Небојша Камбер