if (url.indexOf("services") >0) { --- On Sun, 12/21/08, Wonder95 <killsho...@gmail.com> wrote:
From: Wonder95 <killsho...@gmail.com> Subject: [jQuery] How to get parts of URL after domain To: "jQuery (English)" <jquery-en@googlegroups.com> Date: Sunday, December 21, 2008, 5:10 PM I"m sure this is easy to do, but I can't figure it out for some reason. I'm writing a simple little function in Drupal (in script.js in my theme) to display a different banner image (as a background for an element) based on the URL. So, for instance, if the URL is http://www.mysite.com/services, I want to display one image, if it's http://www.mysite.com/about-us, I want to display another one, and so on. Is there a built in way to get everything after "http:// www.mysite.com/" in jQuery, or do I just need to use window.location and do something like use a regular expression to get what I need? Thanks. Steve