javascript

jQuery remove SELECT options based on another SELECT selected (Need support for all browsers)

Say I have this dropdown: <select id="theOptions1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> I want it so that when the user selects 1, this is the thing that the user can choose for dropdown 2: <select id="theOptions2"> <option value="a">a</option> <option value="b">b...

socket problem firefox extension !!

hello guys, I have a firefox extension where for some reason(for the sake of functionality) i have to employ the use of a tcp server so that it can receive messages from my client application. I am using nsiServerSocketInterface to do it. This works fine. But the problem, comes up when FF is running and i hibernate or put my m/c to sl...

Block auto-refreshers without CAPTCHA?

I am developing a web-based game, and there are some areas of the site that could be taken advantage of fairly easily by setting a simple auto-refresher on the user's browser. What would be the best way to detect this without having to have a CAPTCHA when just generally browsing the site? The site is built using PHP and Javascript/AJAX...

Removing list elements with Greasemonkey

A blog I read has some annoying commenters. I thought I would try my hand at Greasemonkey to turn them off. The basic structure of the HTML is simple - a comment looks something like this: <li> <cite>user name ...</cite> comment text </li> So with that in mind, I bashed my head against the keyboard for a while until this dropped...

JQuery "get" failure (using Google App Engine on the back-end)

What I am trying to do is pretty simple: yet something has clearly gone awry. On the Front-End: function eval() { var x = 'Unchanged X' $.get("/", { entry: document.getElementById('entry').value }, function(data){ x = data; } ); $("#result").html(x); } On the Back-End: class MainHandl...

Comet, responseText and memory usage

Is there a way to clear out the responseText of an XHR object without destroying the XHR object? I need to keep a persistent connection open to a web server to feed live data to a browser. The problem is, there is a relatively large amount of data coming through (several hundred K per second constantly), so memory usage is a big problem...

Basic question about positioning DOM elements with JavaScript

Hello everybody. I recently started to learn JavaScript and how to manipulate DOM elements. So far it been great and I really enjoying the learning. However, there is something that i am having a hard time to grasp. It is positioning elements with the JavaScript. All the offsets, clientsX(Y) and others just confusing me. And it is frus...

Get height of enter browser window in ie8

I'm trying to resize a browser (I know... I know...) by the width only, and would like to maintain the users current height of the browser and I'm struggling to get it working correctly under IE8. if I do: window.resizeTo(document.documentElement.clientWidth, document.documentElement.clientHeight); Which should in theory, maintain th...

Any way that I can assign window.open(url) into cookies array in javascript?

Does anyone know how can I assign window.open(url) into cookies array in javascript? Below is the code that I used at the moment, but seem not really working well for me.... var expiredays = 30 var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie="childWindowHandles["+num+"] =" +window.open(url)+ ((expir...

How to detect if a string is encoded with escape() or encodeURIComponent()

Hi guys, I have a web service that receives data from various clients. Some of them sends the data encoded using escape(), while the others instead use encodeURIComponent(). Is there a way to detect the encoding used to escape the data? ...

Method to 'compile' javascript to hide the source during page execution?

I wanted to hide some business logic and make the variables inaccessible. Maybe I am missing something but if somebody can read the javascript they can also add their own and read my variables. Is there a way to hide this stuff? ...

Does VBScript's IsEmpty have an equivalent in JavaScript?

Using Javascript, is there an equivalent function or functionality so VBScript's IsEmpty function? The VBScript function returns whether the given variable is "empty", e.g. since all the variables are actually VARIANTs, whether or not the VARIANT has a vt of VT_EMPTY, whereas most of what I've found for Javascript is string-specific or ...

What's the best jQuery product zoom plugin?

I'm not much of a frontend guy, just learning jQuery, so any help is appreciated. What's the easiest, most stable jQuery zoom plugin? I have a regular size product image and a detailed image. I need to be able to zoom in somehow. Which would you recommend? ...

Javascript Local vs Global

I thought I had this mess sorted out in my head but for some odd reason its not working. If you declare a variable outside of a function / scope and refer to it without the var inside a function then it changes the variable declared previously... right? however, the first alert returns the correct price, but the second (last) alert ret...

How to pass an Array object to the setInterval function

I want to pass an object array to the setTimer function in Javascript. setTimer("foo(object_array)",1000); am getting error on this code. Note:Sorry ! some correction in my question : Is it possible in setInterval() function. ...

Advice on general way this wizard form should be layed out....

I'm doing a wizard form with about 5 steps where you build a product by choosing items from different categories at each step. In each step, the user will be presented with a list of multiple items each with item name, small preview image and a checkbox to select. On mouseover of an individual item, I'd like to display a larger image a...

can we assign object into cookie in javascript?

Does anyone know is it possible to assign an object into cookies in javascript? If yes, how can we do it? ...

input field, only numbers jquery/js

Hey all :) I have a input field where i only wish users to type numbers html: <input id="num" type="text" name="page" size="4" value="" /> jquery/ js: $("#num").keypress(function (e){ if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){ return false; } }); hope someone can help me. btw: I'm not inter...

Observing events for elements with a certain class or that element's children using event delegation

I have a page with elements similar to this: <div id='things'> <div class='thing'> <div class='activator'> <span>Some text</span> </div> </div> </div> The code is similar to this: $('things').observe(click, function(event) { var e = event.element(); if (e.match('.activator')) { doSo...

Race Condition because of multiple AJAX reqeusts

hi, my problem is the following. I wrote a class AJAXEngine, which creates in the constructor a new XMLHttpRequest object. The class contains a method called responseAnalyser, which is called when the "onreadystatechange" of the XMLHttpRequest object has changed. So now I created lets say 4 instances of AJAXEngine => 4 XMLHttpRequest ob...