[jQuery] How to get parts of URL after domain

2008-12-21 Thread Wonder95
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,

[jQuery] Re: How to get parts of URL after domain

2008-12-22 Thread Wonder95
Could you explain that construct? I'm no JS expert, and I haven't seen it before. Thanks. > If you want to do it in JavaScript, you don't need jQuery, regular > expressions, or indexOf. window.location (or just location) has several > properties that give you different pieces of the URL. locati

[jQuery] Re: How to get parts of URL after domain

2008-12-22 Thread Wonder95
OK, so if I try using that to set my banner, I come up with something like this: var img = { '/ops/content/services': 'banner2.jpg', '/ops/content/services': 'banner3.jpg', }[location.pathname] || 'banner1.jpg'; $("td#header").css("background","url(/ops/sites/all/them

[jQuery] Trying to get CrossSlide plugin to work

2009-02-01 Thread Wonder95
I'm trying to implement the CrossSlide plugin with Drupal and I'm not having any luck. Based on some help I got from this group, I have this code that sets a different banner depending on the URL in script.js (at www.oregonpatrolservice.com): Drupal.behaviors.setBanner = function (context) {

[jQuery] Adding error message in HTML with form validation

2008-08-30 Thread Wonder95
I'm trying to do some simple form validation, and I can get one response to work but not another one. I have a simple form in a sidebar block (in Drupal) that is an area calculator (user enters length, width, and height, clicks Calculate button, and area field is filled in via jQuery). That part

[jQuery] Re: Adding error message in HTML with form validation

2008-08-30 Thread Wonder95
> $('#edit-square-area').after(''+errorMessage+''); > > - Richard OK, thanks, that works in this case. But say for some reason I need to add a class to the dynamically. What would the syntax be to shift focus to that element after appending it to #edit-square-area so that I could use addClass

[jQuery] Re: Adding error message in HTML with form validation

2008-08-30 Thread Wonder95
On Aug 30, 2:06 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > This works fine for me: > > $("").appendTo("#main").text("appendTo").addClass("cool"); > > as does: > > $('' + 'insertAfter' + '').insertAfter("#main").addClass('cool'); > > See here for a full page example with both: > > http:/

[jQuery] Syntax for specifying size of new window with window.open

2008-11-05 Thread Wonder95
OK, I know I'm not the first one to ask this, but I'm stumped. I'm working on a Drupal site, and the client didn't like my nice block I created for a little calculator, so they want a popup window instead. So, I created a separate .htm page with the HTML for the form (four fields plus a button to