javascript

How do I set up an automated "Quote of the day"?

Hi all, I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. See Here (on the right of the page) What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number of quotes (stored in an xml file) and rounds down. While this met...

Youtube Javascript API to create audio bar

For people that have experience with the Youtube Javascript API, I was wondering would it be possible to create a completely customized audio player using the API. My objective is to simply use the API to play sound from a embed youtube video, pause, change volume, from javascript buttons, without ever displaying the flash object itself....

Why $('a.current').parent('li').addClass('current'); is not working?

Why $('a.current').parent('li').addClass('current'); and $(this).hasClass('current').parent('li').addClass('current'); are not working? a click event must add li.current http://jsfiddle.net/laukstein/ytnw9/ Update: Dropbox is Down, so I updated http://jsfiddle.net/laukstein/ytnw9/1/ with full JS $(function(){ var list=$('#lis...

trying to replace "\" char using javascript for a json parser

so I have the following line of javascript: YAHOO.lang.JSON.parse(txt) where text is a string that is pulled from the database. This is an example of one of the problem strings I'm getting back: 5000\25\30% The JSON parser is throwing syntax errors on the / character as far as I can tell. I looked through threads here and most of t...

what is a lambda language?

I was reading "javascript good parts" author mentions that javascript is first of the lambda languages to be launched. JavaScript's functions are first class objects with (mostly) lexical scoping. JavaScript is the first lambda language to go mainstream. Deep down, JavaScript has more in common with Lisp and Scheme than with Java. I...

What's your favorite way to test the javascript in your djangoapp?

Hi, I've been working with django a lot. Now I have an app with JavaScript integrated which I want to test. What's your favorite way to integrate real-browser-tests in the django unittest environment? twill? selenium? windmill? ...

Javascript, local copying of a variable's value... struggling to achieve it

I have what i thought was a simple javascript / jquery function (fade out of one div, fade into another... loop until it reaches a maximum and then start back from the begining. The problem i have though is that to fadein the next div i need to increment the global counter. Doing this increments double increments it because i'm assuming ...

How to write an index loop for a json object

I have an image updater. I am loading by JSON the exact same file/partial that show my images. I would like to write a loop that runs through an index and replaces every image with its equal. This is the first div in my json object : [{ "photo": { "position":1, "photo_file_size":45465, "created_at":"2010-10-05T09:51:13-0...

how to phase? If variable = (condition1) + (anything)...

How would I go about writing this if statement in javascript? if(url == "http://www.google.com/" && "*") { ... } The * needs to be flexible and accept anything added onto the first variable... If no value is assigned to *, the condition must still be true... ...

ExtJs FormPanel - How to submit form using buttons declared inline?

I'm getting started with ExtJs. I'm building a very simple login form: Ext.onReady(function () { Ext.QuickTips.init(); // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var loginForm = new Ext.form.FormPanel({ url: '/Account/Login', monitorValid: true, ...

Jquery autocomplete on large array

Hi all, I am using Jquery autocomplete with local array of size ~5000, every word is ~10 chars. I am initializing the object like this: .autocomplete({matchContains: true, minLength: 3, delay: 700, source: array1, max: 10, highlight: true }) The problem is, that when I start to type, it takes a lot of time (sometime crashes the brows...

Restoring selected printer in Acrobat Reader after calling this.print from javascript

Is there a way to save off the current printer before printing and restore it after calling "this.print"? Our web application prints many reports. Most reports are generated and displayed in an iframe on the current web page being viewed. The user can then print by interacting with Adobe's menus. A small number of our reports need to p...

Javascript to detect a toolbar is installed.

I have a web application, some functionality of which is available as a toolbar in a browser (IE, Firefox, Chrome). I am now required to write a functionality in the app to detect if the toolbar is installed or not. How can I do that? Javascript, Java, GWT open to any of these. ...

Obscure break in div tag

I am trying to make a div which expands to show hidden content when hovered over. However there seems to be a random space in between images inside the div, hence a premature onmouseout method call. Is there any way to get rid of this problem? Check out a live version here. ...

How to add an HTML attribute with jQuery

Well, I have this jQuery image slideshow that uses the attribute "control" inside an <a>. Seeing how it didn't validate I searched for a way to add this attribute inside my HMTL via jQuery but I didn't really find anything relevant. Now I don't really care about how valid my page is, but I'm really curious in how to add an HTML attribute...

In HTML/Javascript, Can I get an element by coordinates, regardless of the mouse position?

Hi all, Is it possible? Get an element by coordinates, without using mouse or other device/resource, just passing top and left parameter like getElementByCoordinates(top,left); ? Tks, Manoel ...

Javascript DOM/XML-object as function parameter

I am interfacing with an existing API (from Garmin) that is very poorly documented and I need some help. The function I am calling is expecting a parameter that I don't know how to initialize properly. The code in the API looks like this, where activities is the parameter I supply: if (activities != null && activities.length > 0) { ...

Firefox Jetpack Development Debugging

So, I'm working with some JS in Firefox and also working with the jetpack sdk. I am working in a JS editor, and then I run the sdk through the command line. However, when there is a bug there is no way to debug this because the JS is being run/loaded before the page and the DOM so firebug is to no avail. Can anyone recommend a better t...

External Javascript Interface on Flash Player not working on CDN (Cloudfront)

I have a flash player with an external javascript interface: reloadData() I'm calling that function via Javascript when editing information on the page - basically to keep data on the page and in the player in synch. The reloadData() function works fine when the player is hosted locally. When we move it to the CDN (Amazon Cloudfront),...

How to get the time from google javascript api

When we search google for "Time Texas" it returns the local time for Texas and its same for any location in the world. It calculated the correct time with day light savings adjustment etc. How can we make a similar call using the Google search JavaScript API and get the time for any given location. ...