javascript

Javascript and CSS - Compress and Caching

I have a single huge minified JavaScript file (ditto for CSS). I am looking for some optimization in terms of speed of download and caching. I want to set the expiry headers for both these files such that with only 2 HTTP calls I get them (and until I change their version number in the URL) want them to be cached. My question is - Whe...

How to pass parameter to javascript function that contains web service results?

I use this function in javascript to call web service (WCF): function Do(caller) { MyService.GetClient(some_id, CallBackGetClient); } function CallBackGetClient(WebServiceResult) { var result = WebServiceResult; etc. } Now I want to pass parameter (caller) to CallBackGetClient function so I can make dictinction who called Do...

Anythingslider problem

Hi guys, i'm using the AnythingSlider, but when i only got 1 item in the slider i get a error saying "'base.$navLinks' is null or not an object" on line 149, you can see the code here: http://pastebin.com/K7EaiFuT, can anyone see what the problem is? thanks :) ...

Can't get Javascript to set text

I see examples for this all over, but for some reason, mine isn't working. I have a textbox that is added dynamically if a certain value is selected in a select list. The part where the field shows up is working, but I am also trying to add some text to the box, which I can't get to work. I'm also trying to use JS to select the text onc...

How do I show character count in YUI when editing a cell?

Hi, In the YUI datatable I want to limit the number of characters a user can type into one of the cells. I know how to properly display the amount using a formatter, but is there a simple way to change the editor box to show a "124/500" character count limit? ...

How can I customize FancyUpload to upload multiple files, each with its own data (e.g. caption, title)?

I'll be answering this question I want to allow my users to upload multiple files in one go and want to use FancyUpload to do it. I can get a basic version of FancyUpload working but I now need to allow users to specify some metadata for each file such as a caption or title. Unfortunately, I've run into a couple of problems. First, I n...

Javascript: stringify object (including members of type function)

I'm looking for a solution to serialize (and unserialize) Javascript objects to a string across browsers, including members of the object that happen to be functions. A typical object will look like this: { color: 'red', doSomething: function (arg) { alert('Do someting called with ' + arg); } } doSomething() will only...

Dojo Query, Query ?

I am trying to use dojo drag and drop within an application. Although I have ran into a little problem basically when a user drops an item into a dijit pane I would like it to target the table below the dijit. I have been able to acheive this if I do the following: day1Drop = new dojo.dnd.Target(dijitDiv.id,{accept: ["shift"]} ); //...

Javascript processing Cyrillic input

When i get a json feed from a Cyrillic site, the data is in a \ufffd format instead of Cyrillic chars. (example feed: http://jsonduit.com/v1/f/l/7sg?cb=getJsonP_1284131679846_0) So when i set the source html to the input, i get weird boxes instead of characters. I tried to unescape the input but that wont work too. How do i revert the...

"Invalid postback or callback argument" after new deployment

Recently deployed a project into production and have run into the "Invalid postback or callback argument" error. We haven't encountered this in testing at all and after some research have found that the problem occurs in the following situation: Old version is published and accessed. New version is published and accessed without cleari...

Register Client Script with Dynamically Loaded Control in Ajax Call

I have a page that contains a custom tab control. When you click different tabs, it does a an ajax callback. During that ajax call, the code dynamically loads a different control based on which tab was clicked, then adds it to the appropriate tab. So basically I have some code that does a switch statement, uses LoadControl(), then adds t...

JQuery grid vs traditional web model for pagination/sorting/filtering

We are developing some new GUI screens to display tabular data which require sorting/filtering/paging. What are the pros/cons of using a JQuery grid approach vs the "traditional" model where these functions are done on the server and where you do a new server request for each action (ie: "next page", "sort on a column", etc)? Some of t...

TinyMce Formatting problems

I recently put the use of TinyMCE in an application I am working on. Everything is working, but the Toolbar is shown on the bottom. I checked the documentation at. TinyMCE Configuration This doc shows how to configure the location of the toolbar given you are using Advanced mode and not Simple. I have confirmed that I am using the corr...

How to create MooTools class of a variable name

Consider this code: var Someclass = new Class(); var Anotherclass = new Class(); var classes = ['Someclass', 'Anotherclass']; and I want to create mootools class with a dynamic name. Of course i can do it by eval: eval('var obj = new ' + classes[0] + '(params);'); but I do not think it is a good solution. How to do this in a "prope...

Case Sensitive Accent Folding in Javascript

You wrote this code: accentsTidy = function(s){ var r=s.toLowerCase(); r = r.replace(new RegExp("\\s", 'g'),""); r = r.replace(new RegExp("[àáâãäå]", 'g'),"a"); r = r.replace(new RegExp("æ", 'g'),"ae"); r = r.replace(new RegExp("ç", ...

Use existing spreadsheet formulas in a custom formula in google docs/spreadsheets

I like writing my own formulas inside of Google Docs Spreadsheets. But often what I want to do is very similar to a function that already exists. As an example, I couldn't find a function to turn a date (31-Aug-2010) into the lexical day of the week (Tuesday). I'd like to write: =LexWeekDay('31-Aug-2010') 'Tuesday' Clearly I can write...

Animating the height of a continer on jQuery.load()

I'm using $('#container_div').load(url) to populate a div via ajax. I would like to animate the height to the height of the returned content but really cant figure out how to achieve this. I've tried using something like this: $('#main').fadeOut(function() { $('#main').load(url, function(data) { var newHeight = $(data).height();...

Move active element loses mouseout event in internet explorer

In a library I am using I have the task of moving an element to the front of the dom when it is hovered over. (I make it bigger so I need to see it, then shrink it back when mouse out). The library I am using has neat solution which uses appendChildren on the active element to move it to the end its parent so further towards the end of ...

I have a JS Lint question

Why do I get these errors? Problem at line 329 character 60: Do not use 'new' for side effects. new widget.StyledDropdown(dojo.byId("sTitle")); Problem at line 330 character 61: Do not use 'new' for side effects. new widget.StyledDropdown(dojo.byId("sSuffix")); Problem at line 336 character 57: Do not use 'new' for side effects. tr...

Jquery Autocomplete with json fails

I am using the auto complete plugin by Devbridge and I have it all installed here is my code: $(document).ready(function(){ $('#request_task').autocomplete({ serviceUrl: '<%= ajax_path %>', minChars:1, width: 300, delimiter: /(,|;)\s*/, deferRequestBy: 0, //miliseconds params: { artists: 'Yes' }, ...