title: How to change the current URL in javascript?
body: <p>On my website:</p>
  
  <pre><code>http://mywebsite.com/1.html
  </code></pre>
  
  <p>I want to use the </p>
  
  <pre><code>window.location.pathname
  </code></pre>
  
  <p>to get the last part of the url:</p>
  
  <pre><code>1.html
  </code></pre>
  
  <p>and since I have all my webpages in numbers I want to add 1 to the current url so that when I click a button it will redirect me to the next page:</p>
  
  <pre><code>var url = 'http://mywebsite.com/' + window.location.pathname;
  function nextImage (){
  url = url + 1;  
  }
  </code></pre>
  
  <p>any ideas why this is not working ?</p>