pulling text from url and putting text back in url with javascript -


i have tried googling can't find i'm looking for. have url has number in it. want able take number there , depending on number there interject name url. example:

let's url is: www.example.com/video15637

can take number , like:

var namevariable;  if(video15637){ namevariable = video15637; } if(video26597){ namevariable = video26597; } if(video18737){ namevariable = video18737; } 

then, somehow interject namevariable url displayed?

you can try with:

var = document.createelement('a');     a.href = 'http://www.example.com/video15637';  var namevariable = a.pathname.substr(1); // video15637 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -