-1

My page url like is just like that http://wallpapers.wapego.net/main.php?ses=SuNpnTR5PRYTkYXYN3syARtUHN7&f=3153038 now i want to take a part of current url that is 3153038 and store it into javascript variable

2 Answers2

0

Since you give us no information other than this one URL, you can do it very naively by simply:

> var uri = 'http://wallpapers.wapego.net/main.php?ses=SuNpnTR5PRYTkYXYN3syARtUHN7&f=3153038'
< undefined
> var foo = uri.split('&f=')[1]
< undefined
> foo
< "3153038"
Nick Veys
  • 23,458
  • 4
  • 47
  • 64
0

Here's the code to get part of your current url.

var currentUrl = location.href;
var urlPart = currentUrl.substring((currentUrl.lastIndexOf("="))+1);
Viswanath Donthi
  • 1,791
  • 1
  • 11
  • 12