javascript

ASP.Net: Approaches to multilingual websites with Javascript and AJAX

We've recently completed phase 1 of a ASP.Net website in English and French. We went with using resource files to store language specific strings, but because the site used ASP.Net AJAX and javascript heavily we rigged up a solution to pass the right files through the ASP.Net pipeline where we could catch "tokens" and replace them with t...

Why does my spinner GIF stop while jQuery ajax call is running?

I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine. Here's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ASP.NET) I've got it all working, except that the spinner is...

How do i submit an ajax request before the page is loaded

I want to check the login status of a user through an ajax request. Depending wether the user is logged in I want to display either the username/password input or the username. Currently the request is sent on body.onload and a prgoress indicator is shown until the response arrives. Is there a better way? Let's assume that the require...

Which effects library should I integrate with GWT?

I am curious if anyone has done a comparison between the different options out there. So far I am leaning towards using Moo.fx because loading prototype.js just to use scriptaculous seems a bit much. Does that make sense? Are there any other effects libraries worth trying? Thanks. ...

How do I access the "displayed" text of a select box option from the DOM?

Given the following HTML: <select name="my_dropdown" id="my_dropdown"> <option value="1">displayed text 1</option> </select> How do I grab the string "displayed text 1" using Javascript/the DOM? ...

Serializing to JSON in jQuery

I know how to serialize an object to JSON in ASP.NET Ajax, but I'm trying to do things on the client in a less Microsoft-specific way. I'm using jQuery. Is there a "standard" way to do this? My specific situation: I have an array defined something like this: var countries = new Array(); countries[0] = 'ga'; countries[1] = 'cd'; ... a...

Are there caveats to dynamicly creating a form with javascript?

I have to do a cross site POST (with a redirection, so not using a XMLHTTPRequest), and the base platform is ASP.NET. I don't want to POST all of the controls in the ASP.NET FORM to this other site, so I was considering dynamicly creating a new form element using javascript and just posting that. Has anyone tried this trick? Is there an...

Asp.Net Static method to refresh page

I have a page that is hitting a webservice every 5 seconds to update the information on the page. I'm using the DynamicPopulateExtender from the Ajax Control Toolkit to just populate a panel with some text. What I was wanting to do, is if a certain condition is met, to refresh the page completely. Am I going to be able to do this in t...

Firefox 'Error loading script' loading Google Analytics in FF2

The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, but so far it seems to just effect one user. His user agent is: "Mozilla/5.0 (Wind...

jQuery Scrollable, Sortable, Filterable table

I'm looking to utilize jQuery to handle a few very common requests we get for data tables of varying sizes: scrolling, sorting, and dynamic filtering. I've handled scrolling in the past by having two separate tables with fixed width columns, along with associated div containers for the "actual" scrolling. However, this method doesn't w...

How Do You Fix A Parameter Names Mismatch - DOJO and PL/SQL

How do you fix a names mismatch problem, if the client-side names are keywords or reserved words in the server-side language you are using? The DOJO JavaScript toolkit has a QueryReadStore class that you can subclass to submit REST patterned queries to the server. I'm using this in conjunction w/ the FilteringSelect Dijit. I can subcla...

Wait cursor over entire html page

Is it possible to set the cursor to 'wait' on the entire html page in a simple way? The idea is to show the user that something is going on while an ajax call is being completed. The code below shows a simplified version of what I tried and also demonstrate the problems I run into: if an element (#id1) has a cursor style set it will ig...

Using Javascript to perform a process and send updates/callbacks to a webserver.

I am working on a process to allow people to upload PDF files and manage the document (page order) via a web based interface. The pages of the PDF file need to be cropped to a particular size for printing and currently we run them through a Photoshop action that takes care of this. What I want to do is upload the PDF files to a dedicat...

How do I share a javascript object between different pages in Adobe AIR?

I'd like to have a custom object attached to the application so I can preserve state in it between different html pages in adobe air. Is this possible? I was asking for a fullblown solution to store a custom js object in memory and persist it between pages loaded from the application sandbox, but this cannot be done unless I use ifram...

Screen Grab with PHP and/or Javascript?

Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG? I'm sure it's possible somehow, but are there any known implementations/libraries that help out? ...

Creating a sortable tree/grid in Javascript

I'd like to create a tree structure from JSON, but with multiple columns that can be sorted. I've seen lots of implementations of trees and grids but never one mixed. Does anyone know of a plugin or feature for any Javascript toolkit that can make this happen so I don't have to re-invent the wheel here? ...

How do you make php's json_decode compatible with firefox's javascript?

it appears if you have something like var my_var = {"foo" : "bar"}; in javascript (with firefox at least) and post it to a php server you will receive a string like {foo:"bar",} on the server side. But json_decode in php doesn't like the trailing ',' or the lack or quotes around 'foo'. Is there a nice way to clean up the received...

How can I simulate macros in JavaScript?

I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using eval(), but as he said, would be quite costly. They don't really have to be very fancy. I just want to do simple stuff with them. And it shouldn't ...

Has anyone used/created "fisheye" table columns?

Has anyone ever given table columns the "fisheye" effect? Im talking about an expanding effect of the table columns when hovering the mouse over them. I'd love to see some code if anyone has tried this. EDIT: ...or an accordian effect ...

What is the best way to do loops in JavaScript

I have stumbled into several methods of looping in JavaScript, what I like the most is: for(var i = 0; i < a.length; i++){ var element = a[i]; } But as tested here (http://www.robertnyman.com/2008/04/11/javascript-loop-performance/), it should probably be written so that the length is only calculated once. In jQuery there is a ....