javascript

dynamically adding sets of form elements n times

i'm working on an application that lets users enter the opening hours for a restaurant. i have the form code set up like this: <div class="hourswrapper"> Days: <input type="checkbox" name="day1[]" value="1" />M <input type="checkbox" name="day1[]" value="2" />Tu <input type="checkbox" name...

In rails controllers, how to prevent double submit (when user double-clic submit button or hit enter twice) ?

Well, everything's in the title but I'll explain a little more :-) My rails app contain many forms (Ajaxified or not). To prevent users to submit twice or more some forms, I use Javascript. There's my scenario for a Ajaxified form : the user submit the form (clic or enter) the javascript disable the submit button the rails controlle...

Javascript unittesting frameworks

Hi all, I am loooking for a javascript unittesing framework and trying to decide if I should go with JSunit or not. My goal is to have the unittests run with my CI, possibly using a JSunit server that is running headless. From people's experience, is this a good idea? Are there better frameworks that you would recommend for my goals, ...

-ms-filter with javascript

How do I implement the -ms-filter in javascript? I tried the following which does not work: document.getElementById(ba[i]).style.sFilter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + value*10 + ')'; Another question. If I want to change the font color of an element I used the following (which worked in everything exce...

Change canvas gradient object's properties.

var i = 0; var x = 960; var y = 540; var interval = window.setInterval(render, 100); function render() { gradient = cxt.createRadialGradient(x, y, i, x, y, i+10); gradient.addColorStop(0, "rgba(0,0,0,0)");//white inside gradient.addColorStop(.4, "rgba(255,255,255,1)");//white inside gradient.addColorStop(.6, "rgba(255,255,255,1)");//...

Run a javascript file on a set of html documents

I have a set of html documents on local disk to process. I need to load each document file as document object and run a piece of javascript code over it and store the result in a separate file. I would prefer to this from python though I'm open to any other suggestions too. I tried to do this through extensions in chrome and firefox b...

tokenizing a metafield.

I am working with a CMS like system, which has a special field defined for use in its forms. This field works similarly to google suggest, executing an sql query behind the scenes and displaying results. The SQL query I am using selects 3 fields from table1, and concatenates them as a result. What I need to do, is split this new metaf...

PHP/HTML/Javascript: How to add value to a div element?

My Problem was: Add a value to a div element in a dropdown list. Ok Guys, I've resolved my problem with the help of @David. I've always wanted to know how to design the <select> <option> tags, but now I think I found a solution to get away from them and use whatever element I want. Ok here is my code: <!DOCTYPE html PUBLIC "-//W3C//DT...

Passing Javascript array to VB .Net code behind method via AJAX?

All I'm wanting to do is pass a JS array to a VB .net code behind method via a AJAX call or other way if there is another way? Can someone point me in the right direction? I'm basically wanting to save the values in the JS array to a database. ...

JavaScript Get all Loaded Scripts

Hi all, I am trying to create a Javascript function that will return all javascript files loaded. For Example: I load jquery.js, jquery.somescript.js, and tinymce.js I want a function to return everything in script format (so if I were to save and run the return text again) it would work just as if I had called the files described abo...

Jquery Animation callback affecting the wrong elements

Hey I trying to make a sort of slider but having a problem getting the loop to 'reset'. The idea is to have the elements animated to fade opacity and when finished make them hidden so that the ".is(:visible)" won't be triggered after the loop has been reset. However the callback function is affecting the elements that are having their op...

Is there any way to get Intellisense working in Visual Studio / MVC without the "if(false)" hack?

Other than the "if(false)" hack, is there any way to get Intellisense working in VS 2010 / MVC when using the server-side Url.Content() method for re-basing Javascript files? Master Page: <script src="<%=Url.Content("~/Scripts/jquery-1.4.2.js") %>" type="text/javascript"></script> I know about the if(false) hack but I was hoping ther...

How to read text from a website using Javascript ?

I am writing an HTML code for my cell phone. Its essentially a Dictionary App where I input a word and I look up the meaning from say, Dictionary.com ; I am using Javascript to get the string but can I embed the word into the URL, "http://dictionary.reference.com/browse/" Is there any way of doing this ? ...

Universal PNG fix script?

Does anyone know of a universal, one stop PNGFix script that isn't dependent on a specific library (like jQuery or Prototype?). I just want to drop it in the header and have it take care of all transparent .png's from my stylesheets and markup. Can't seem to find one that will do the job. ...

.Exe on Server-Side

Hi , This is a quick question.I just want to know if it is possible to invoke a .exe file on server side by an RPC from client? Thanks. ...

How can I make a radio button control all of this?

When visitors register on my site, they will do so as the founding member of a group or as a person joining an existing group. Nobody is "group-less." I have a single registration page with the following fields: first name, last name, (radio buttons to choose group type: New or Existing), group name, group password, email, pass, confirm...

Accessing text in a field placed by JS, via PHP

In PHP, in a particular CMS I am using a custom field, which works like google suggest. As in, for each letter I type an SQL query is performed and matching records are displayed. When clicking on a record it fills the field with that record. I am fairly certain this is all done with JavaScript. I need to know how I can access the res...

Dashcode Lists in Firefox

I have a list in dashcode where I update a parameter for the datasource and tell the list to reload. The code is fully functional when view from Safari but the reload command does not appear to work when the same page is viewed in Firefox. The code I am using to update my data source is: dataSource.setValueForKeyPath("keyboard/build/", ...

How to pause and restart playing Flash audio in JavaScript

I'm actually using Lectora, which controls Flash (FLV) audio and video using a JavaScript program. I actually know how to pause a piece of video if I know its name, but what I want to do is create a button which will pause the current audio (or video, but that's less common), allow me to open another window which also plays audio, then ...

How to prevent delegated handlers on a parent without preventing default in jQuery?

Is there any way to prevent a click from an <a> triggering delegated click handlers on its parent, while allowing the the <a>'s default behavior to occur (navigating to the href). Here's an example that illustrates what I'm asking. <div class="top"> <div class="middle"> <a href="google.com" class="link">link</a> </div> ...