javascript

how do i refer to the subject $(this) from a jquery plugin?

I'm using colorbox, i just get undefined as my get values? $('.banner').colorbox({ opacity: 0.4, href: 'dialogs/ban_add_edit.php?banner_to_edit='+$(this).attr('id')+'&typeofbanner='+$(this).attr('rel') }) ...

how to download client side content

I want to let the user download the current content of a textarea into a text file on their computer. In the past I would create an iframe pointing to a URL with the data, which would trigger a file download dialog. However this time the data is client side. So, is it possible to let the user download data without sending it server sid...

Is there a decimal math library for JavaScript?

Is there a mature library for doing decimal-based math, possibly arbitrary-precision, in JavaScript? Edit: I want this information for a reference page on floating-point-related problems and alternatives to use when binary floating-point is inappropriate: http://floating-point-gui.de/ ...

VS2008: Is there a way to enable bracket matching for javascript?

The bracket matching in VS2008 is a handy feature, but doesn't seem to work for javascript code. Is there a way to enable it? ...

What are the use cases for closures/callback functions in Javascript?

I was listening to Crockford's talk on Javascript closures and am convinced of the benefit of information hiding, but I do not have a firm understanding of when to use callback functions. It is mostly a true statement that a person could accomplish the same functionality with or without callbacks. As someone who is writing code, what h...

Do .htc style behaviours still work if javascript is disabled?

Do .htc style behaviours still work if javascript is disabled? I'd like to use whatever:hover to create some css only drodpowns and would like to know if IE will still pay attention to the htc file if js is disabled. ...

window.alert in worker thread

If I put a window.alert on a webworker client, then the background worker stops working. Why is this so? i.e. The caller: var worker = new Worker("worker.js"); // Watch for messages from the worker worker.onmessage = function(e){ // The message from the client: e.data }; worker.postMessage("start"); The client (worker.js) onmess...

How to send parameters with same encoding from javascript?

I have a javascript file that lots of people have embedded to their pages. Since I am hosting the file, I have control over that javascript file; I cannot control the way it is embedded because lots of people is using it already. This javascript file sends GET requests to my servlets, and the parameters passed with the request are recor...

jquery menu with saving position

is any menu like treeview (open\hide each node), but after postback it restore the state ? ...

Returning a Value From the Bit.ly JS API Callback

Hey all, I am attempting to turn this "one shot" script into something more extensible. The problem is that I cannot figure out how to get the callback function to set a value outside of itself (please note that references to the Bit.ly API and the prototype.js frame work which are required have been left out due to login and apiKey in...

jquery checkbox and array help

Hi There I need to get the names and values of checkboxes that have been checked into an array name selected, I cannot for life of me get it working, below is my attempt, if someone could clrify what I am doing wrong that would be brilliant. //Location AJAX //var dataObject = new Object(); var selected = new Array(); $('#are...

When and how to validate HTML using contenteditable?

I'm exploring the idea of using contenteditable on a website at visitor comments and at a message board. As I only wish to accept a white-list of HTML tags and attributes the question of when and how should I validate the entered HTML content comes up. How would you do it? What cross-browser solutions would you choose to use? What even...

php array in url from json

Here is what I want to do: I have some json like this var foo = { format:"json", type:"test", id:"26443" }; and I awant to put that in a url like this 'http://example.com/a:3:{s:6:"format";s:4:"json";s:4:"type";s:4:"test";s:2:"id";s:5:"26443";}' which I will then put into ajax call but everything I have tried results...

Uploadify Not Working

EDIT: It seems the issue is to do uploadify not having a session, therefore it could not access the page I was sending it to. So make sure you point it to a page with no admin login security ;) This was due to an issue with the url that uploadify was accessing. As it has no session it couldn't retrieve anything. ...

jQuery/Javascript problem with IE

I have two radio buttons each with a unique ID. When one is clicked, I would like to add $10 to a total. When the other is clicked, we go back to the original total price. My jquery looks like this: function check_ceu() { var price = <%= conference_price %>; if($('#ceu_yes').is(':checked')){ $('#total').val(parseF...

Regex: how to get contents from tag inner (use javascript)?

page contents: aa<b>1;2'3</b>hh<b>aaa</b>.. .<b>bbb</b> blabla.. i want to get result: 1;2'3aaabbb match tag is <b> and </b> how to write this regex using javascript? thanks! ...

Javascript callback on blackberry

I'm working on a mobile project, and I have a script that is dynamically generated on the backend and then appended to the document (the html page). Desktop browsers seem to append the script correctly and call any functions in the script, however, I can't get this to happen on Blackberry phones. I know that the script is being appending...

jQuery offset combined with jQuery UI doesn't update on drag

I need to get the offset of the element that is being dragged and I use: $(function(){ $(".draggable").draggable({ stop: function(){ var offset = $("#boxone").offset(); alert(offset.left); } }); }); the element is positioned absolute and has a CSS of: left:100px; that is the value ...

Extjs: Tree, Selecting node after creating the tree

I have a simple TreePanel. I would like to select a particular node upon loading it. The nodes are from a remote file (json). The tree is loading as expected. However, the node is not being selected. Firebug shows node as undefined. This perhaps because of the async property. But, I an unable to configure this other wise, or spe...

Inserting Cells Into A Table ?

How do i go about inserting a cell into a table? For example, i retrieve data from a database using MySql and PHP, how do i then go about inserting a cell into an already scripted table? In my case, how would i insert a cell into a row 150 pixels from the start of the row? example: ___________________________________________ | <--15...