javascript

Cross-Browser Issue Regarding onchange/onfocus

Hi, I'm trying to turn a <label/> and <input type="radio"/> into a single button that when clicked, adds that specific product to a shopping cart. This example deals with 1 product, with potentially multiple variants, (ie. The Product would be "Denim Jeans", the Variants would be sizes, "26", "27", "28"). The HTML would look something...

RegEx Pattern to Match Only Certain Characters

I'm a newbie to RegEx, and this particular issue is flummoxing me. This is for use with a JavaScript function. I need to validate an input so that it matches only this criteria: Letters A-Z (upper and lowercase) Numbers 0-9 The following additional characters: space, period (.), comma (,), plus (+), and dash (-) I can write a patter...

Framework design -- reading recommendations

I'm writing a small application framework which other programmers will use. So I'm looking to do some reading on framework design issues. I'm not completely new to framework design, but it's always a bit of a challenge. Although I'm looking for general design principles, this particular framework is for Javascript applications, so it wi...

I want to make a "Web 2.0" application without using JavaScript directly. [Details Inside]

I'm a full time Java developer of around 4 years, professionally. I'm a GWT fanatic. I love Java. Here's the problem: In my free time I often fall victim to the verbosity of my favorite tools for doing "heavy" development. I also often fall into the trap of obsessively engineering my software. I'll end up with the most beautiful un...

Can I view the result of a callback function using console.log() in Firebug?

Using the example below, is it possible to send the result of the callback function to the console, i.e. the value being returned? rows.sort(function(a, b) { if(a.sortKey < b.sortKey) return -sortDirection; if(a.sortKey > b.sortKey) return sortDirection; return 0; }); What would I use as the argument: console.log(?) ...

Is there a change-tracking framework for JavaScript?

ASP.NET AJAX 4 recently added the ability to track changes to ADO.NET Data Services objects on the client side. That got me wondering what other change tracking JavaScript libraries exist. Has anyone seen any, or are you using any? EDIT: Just to clarify what I mean by "change tracking": the new version of ASP.NET AJAX allows you to re...

Problem making request to server with Jquery

I have a problem making a request to a server My simple code is: <html> <head> <script type="text/javascript" src="/Users/t/Desktop/App/etc.../jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/Users/t/Desktop/App/etc.../json_parse.js"></script> <script type="text/javascript"> $.getJSON("http://127.0.0.1:8000/search/"...

Do jQuery Attribute/Value changes trigger corresponding event handlers bound to the element?

For instance if I select a radio button through jQuery code does this fire the onClick event for that particular input? ...

Disabled Text Field Value Not Being Recognized in SQL

I have a text field that is disabled based on who the user is. When the page submits, the value of the text field is supposed to be inserted into a SQL table, but SQL seems to see the value as empty because the text field is disabled. Can anyone tell me a way to get this value into SQL, i.e. for SQL to actually see the value? Below is ...

Break out of framed page before load

Hi, I have a aspx page that is inside a frame. I want to redirect to a new page but before that page loads, break out of the frame. I was using this js code window.onload = TimeOutRedirect; function TimeOutRedirect() { try { if (self.parent.frames.length != 0) self.parent.location=document.location; } catch (E...

Getting the same value of the radio button selected using Val()

Hello all, I have a form and I wish to get the value of a radio button but it always gives me the same value ("floating") even though I select a different radio button and I run this function?! HTML: <input type="radio" id="license_floating" name="license" value="floating" class="realtime" /> <input type="radio" id="license_fixed" nam...

Using My Own Callback with an HttpRequest Object

I'm writing an Http Request without the use of a library (another script was having conflits...) But Im having trouble with the scope of my object. Below is the calling script, then the Ajax_Request object follows. function loadCard(e) { var element = e.target; if($('overlay')) { return false; //something is already over the layout } ...

how to pre-select an option in a dropdown in javascript?

i have this code for a dropdown if (chosen == "Parade") { selbox.options[selbox.options.length] = new Option("Select Venue",""); selbox.options[selbox.options.length] = new Option("Benavides Park","Benavides Park"); selbox.options[selbox.options.length] = new Option("CME Auditorium","CME Auditorium"); selbox.options[selbox.optio...

Escaping Apostrophes Input by Users Through Text Fields in a Rails App?

Update: If you look at the javascript code that I pasted in the update below, I have single quotes around the variety.name variable. I think I was just following a tutorial in doing that. Turns out that when I switch those to double quotes, everything works fine. Question: Is this a stable solution? Or would it still be better to imp...

Prototypal vs Functional OOP in JavaScript

What are the pros and cons of each type/approach in writing Object Oriented scripts? Personally, I have found closures (functional? approach) as a way to encapsulate state more natural and perhaps more elegant. I, however, have heard that this use of closures is slower in JavaScript implementations. I would at least like to know where ...

Simple jquery popup

I'd like to make a very simple jquery box come up saying "Sorry, that blog post could not be found." I don't want anything very advanced... How should I go about this? ...

what are the "for" and "event" attributes of the script tag (Javascript,HTML)

In a web application I've inherited at work which was written about 10 years ago I've noticed the following code snippets repeatedly used: <script language="JavaScript" for="FG1" event="Mousedown(Button, Shift, x, y)"> { // some code here that uses the variables Button, Shift, x and y } </script> I've never really seen anything lik...

How to make a double linked-list in javascript + html

I have a class called listaDoble, in a Javascript document. And I have another HTML document with a text field and 4 buttons: Next, Back, New. When I press the New button I put, onmouseclick="lista= newListaDoble();", but then I lose the reference to the object. Some help? ...

Detect if javascript is enabled in a winforms/mfc embedded browser

I have a native (windows) application that has an embedded web browser. Currently I'm invoking a javascript function from the backend (c++/c#). However, if javascript is disabled this fails and I'd like to provide a fallback mechanism. Is there a way to determine if javascript is disabled? ...

innerHTML flash video not loading problem

Hi, when the "preview" link is clicked it is meant to change the video script and video swf using the innerHTML method, however in IE 7+ the flash seems to appear but never loads the video i.e. it just stays white. <script> function changeVideo(filename,script) {document.getElementById('video').innerHTML = '<object classid="clsid:D27CDB...