I have this code which retrives the anchor value from the url.
(www.example.com/page#topic1 > gives 'topic1' )
I want to do a very simple thing, add, for example '10' to the anchorvalue variable.
So if we have www.example.com/page#20 the anchorvalue gives '20' and I want to increment that value in '10' so that I get '30'.
But that gives 2010 and not 30!
How can I achieve what I want ?
Thanks in advance.
(www.example.com/page#topic1 > gives 'topic1' )
Code:
var anchorValue;
var url = document.location;
var strippedUrl = url.toString().split("#");
if(strippedUrl.length > 1)
anchorvalue = strippedUrl[1];
So if we have www.example.com/page#20 the anchorvalue gives '20' and I want to increment that value in '10' so that I get '30'.
Code:
var anval = anchorvalue; var sumvalue = [B]10[/B]; var newanchorvalue = anval + sumvalue;
How can I achieve what I want ?
Thanks in advance.
Comment