javascript

Address String Split in javscript

Ok folks I have bombed around for a few days trying to find a good solution for this one. What I have is two possible address formats. 28 Main St Somecity, NY 12345-6789 or Main St Somecity, Ny 12345-6789 What I need to do Is split both strings down into an array structured as such address[0] = HousNumber address[1] = Street...

Javascript generated image maps don't link in any IE

In this static version, in any browser, you can click on the close area to jump to http://www.google.com. <html> <body> <div id="my_div"> <img usemap="#map" src="http://specialmedia.wnyc.org.s3.amazonaws.com/ads/open.jpg" /> <map name="map" id="map"> <area shape="rect" coords="900,0,1000,20"...

Are there ways to improve javascript (Dojo) loading?

I'm starting to use the Dojo toolkit and it has rich features like Dijits and themes which are useful but take forever to load. I've got a good internet connection but those with slower connections would experience rather slow page loads. This is also a question about heavy vs light frameworks. If you make heavy use of widgets, what ar...

PHP MVC: Where to Put Dynamically Generated Javascript

Most PHP MVC systems follow a pattern where a request is routed to a specific controller action, and then the controller sets a bunch of variables for use in the view. When you're in an agency/services work environment that uses a lot of dynamic HTML for UI elements, this patterns leads to a lot of javascript being generated with view v...

Collapsable repeater in ASP.NET

I have a repeater that currently displays a list of counties and townships within those counties. The county records and township records are treated the same in the repeator, aside from having different RowFormat attributes. Each record also has a unique id and the unit (whether it be a township or county) name to display. There is also...

Javascript Global Variable Trouble

I'm having trouble with Global variables in Javascript. From every article I've read a variable declared out of a function has a complete scope. But bellow; var leftMargin = 36; alert(leftMargin); /* '36' */ function position(direction) { alert(leftMargin); /* 'undefined' */ } ...

Select a complete table with javascript (to be copied to clipboard)

Hello everyone, I was wondering if anybody knows how to select using js the complete table, so that the user can right-click on the selection, copy it to the clipboard and then paste it on excel. If you select the table manually, the process works perfectly. But sometimes, if the table height is a few times larger than the screen, sele...

Finding out what line number an element in the dom occurs on in Javascript?

Though I've never heard of this but, is it possible to retrieve a node from the DOM using JS, and then find out on what line of the file that node occurred on? I'm open to anything, alternative browsers plugins/add-ons etc...it doesn't need to be cross-browser per say. I would assume that this would be possible somehow considering that...

Access control for cross site requests in Internet Explorer

I am trying to make an AJAX call from several domains to a single one which will handle the request. Enabling Cross domain in Firefox and Chrome was easy by setting the header on the handling server: header("Access-Control-Allow-Origin: *"); But this doesn't help enabling it in Internet Explorer. When I try: httpreq.send(''); it st...

jQuery events executing code in unexpected order

I'm having an issue with some of my code executing in an unexpected order. I have two buttons each with a function bound to the click event. One button is 'cancel' and it makes some display changes. The second button is 'done' which saves changes by writing them to a hidden input field and then triggers the event handler on 'cancel'. Thi...

JQuery 'Jcarousel' plugin bug, help needed...

I am using JCarousel to display some ads. Everything works fine, except when there is no ads, ie JCarousel has zero content. This will cause the Next Button to be active, as if there where unlimited items inside the carousel. I haven't altered any code at all, just the css for the colors and attributes. Does anybody know what I am talk...

What is the easiest/best way to show that an HTML element is AJAX Loading?

Sometimes in my application there are many elements loading so I want to show the typical AJAX spinner above the control (or DOM node) with it disabled. What is the easiest/best way to do that? Ideally I would like to: $("#myelement").loading(); $("#myelement").finishloading(); Or even better being able to do AJAX requests directly ...

default array values

Is there a way to assign a default values to arrays in javascript? ex: an array with 24 slots that defaults to 0 ...

createElement Image Source

I'm dynamically adding rows/fields in this code. I have a text field for the date, and next to it is a calendar button/image, which the user can use to select the appropriate date. However, if I click the "Add New Item" button to add a new row, I can't quite get this image to re-appear correctly for the calendar. The rows are being ad...

using respond_to format.js to replace the content of a textarea on rails

I have some saved text in my create controller. If it's not stressful, I'd like it to populate a textarea on the page with the saved text along with displaying the error message fields (which is what's already happening). I've used things like replace_html before, but I don't know if there's an easy way to get to textarea or text field I...

Jumping Onload jQuery

Hello. Basically I have a div at the very top of my site that I want to hide and when you click a button it pushes the whole site down and reveals its contents. Very similar to this nd.edu (click help center or poplar sites on the right side of the header). I am using jquery to accomplish this. This script works but it is jumpy, sinc...

Where should I put javascript libraries in a Grails app?

I have a couple of Javascript libraries of my own that do some nice prettyfying of my HTML pages and I want to include them in my gsp pages, particularly the landing page of my app. I have tried putting them in views folder and web-app/js and $APP_HOME/scripts but when I load my index.gsp the scripts don't show up. I have also tried a ...

Select element has no 'options' array

This is doing my head in! I have a select element with several options, however I cannot manipulate or access any of the options, as apparently the 'options' array does not exist. I have recreated the problem in a simpler html document: (original project is ASP MVC) <html><head><title>test test test</title> <script type="text/javascri...

JCarousel JQuery plugin, some help needed...

The next button is enabled even though there are no items in the carousel, and it seems as if JCarousel thinks it has infinite items, because when I click the next, it actually scrolls. I want to disable the 'next' when there are no items in the Carousel. The Carousel works perfectly when there are items in the carousel btw! I have abs...

2 pairs of divs at the same position w/ elastic layout

I've been trying to add 2 divs centered one next to another with two aditional divs on the same position of the last ones but hidden... the big problem here is that I want the page to be elastic... Does anyone know how can I do this? ...