javascript

Are there any good Javascript graphics libraries?

After staring at this 3D cube and these triangles for a while I started wondering if there's any good reliable Javascript graphics library with basic 3D support. Any suggestion? ...

How do I force ASP.NET Ajax to use a script from the FS and not WebResource.axd, or to reduce its HTTP requests?

Here is a hum-dinger of a problem that I have not found an answer for. I am using the ASP.NET ajax control toolkit controls on a few pages, which by nature want to load script resources via WebResource.axd. This is all well and good for some applications, but each call to WebResource.axd requires an HTTP request. Most pages will pull a...

How to format numbers in JavaScript?

How to format numbers in JavaScript? JavaScript culture sensitive currency formatting ...

Webform_SaveScrollPositionSubmit is not defined

Cut a short story even shorter, Have a asp.net page with MaintainScrollPositionOnPostback="true" in the page directive (And I tried setting the same to true in page_load), but I get the above javascript error (Webform_SaveScrollPositionSubmit is not defined) and im guessing the page dosent scroll because that js function is "not defined...

How do I change/replace a flash object with jquery or pure javascript?

I want to change a flash object enclosed within with jQuery after an onClick event. The code I wrote, essentially: $(enclosing div).html(''); $(enclosing div).html(<object>My New Object</object>); works in Firefox but not in IE. I would appreciate pointers or suggestions on doing this. Thanks. ...

Calculate last day of month in javascript

if you provide 0 as the dayValue in Date.setFullYear you get the last day of the previous month: d = new Date(); d.setFullYear(2008, 11, 0); // Sun Nov 30 2008 There is reference to this behaviour at mozilla. Is this a reliable cross-browser feature or should I look at alternative methods? ...

Forcing Google Analytics Tracking Code to Sleep

To use Google Analytics, you put some JavaScript code in your web page which will make an asynchronous request to Google when the page loads. From what I have read, this shouldn't block or slow down page load times if you include it directly before the end of your HTML Body. To verify this, I want to make the request after some period ...

Is there any generalities in the cost of executing an instruction in javascript?

I was wondering, if there is any generalities (among all the javascript engines out there) in the cost related to execute a given instruction vs another. For instance, eval() is slower than calling a function that already has been declared. I would like to get a table with several instructions/function calls vs an absolute cost, maybe ...

How to get the new value of an HTML input after a keypress has modified it?

I have an HTML input box <input type="text" id="foo" value="bar"> I've attached a handler for the 'keyup' event, but if I retrieve the current value of the input box during the event handler, I get the value as it was, and not as it will be! I've tried picking up 'keypress' and 'change' events, same problem. I'm sure this is simple...

Most efficient way to convert an HTMLCollection to an Array

Is there a more efficient way to convert an HTMLCollection to an Array, other than iterating through the contents of said collection and manually pushing each item into an array? ...

Safe, universal, way to use addEventHandler in Javascript?

Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves. Our existing script installs handlers using "old" way (a fancy version of element.onclick = blah; ...

How to find the Vertical size of a window displaying a web page.

I have an ASP.NET Site that has a single Master Page. On one of my pages in this site I display a PDF file as the content of the page. I need a way to know the size that I can make the PDF control so that I do not create a scroll bar for the webpage (the PDF control has it's own scroll bar). I was able to solve this horizontally by se...

I want to write a desktop OSX or Windows app in Javascript -- any experiences?

I'd like to write some small applications for Windows and OSX. Portable is good. For instance, the simple TclKit solution for TCL would work well if I could stand to look at Tcl for any length of time. I'm considering using Javascript + extensions -- I really like Javascript -- seems to me there should be some way to connect a Javascr...

Where do you record validation rules for form data in a web application?

Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc. You can validate in the client with javascript, you can post the data back to the server and report back to the user, either via ajax or not. You could have the validation rules in the database and ...

Swf object doesn't seem to work inside a Blogger post

Any ideas why? On the following link, where it says "So..." there should be an embedded swf. http://blog.iainlobb.com/2008/10/wrong-door-creating-papervision3d.html ...

How much JavaScript do you let Rails generate?

Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates. Rails typically uses inline event handling. <a onclick="somejavascript(); return false;" /> This is generally frowned upon, as it's mixing ...

How can I get the window object that an HTML node belongs to using JavaScript?

Because of several iframes, XUL browser elements, and so forth, I have a number of window objects in my XULRunner application. I'm looking for the best way to find the window object that a specified node belongs to using JavaScript. So, to be more specific, given node x, I need to find the specific window object that contains x. ...

Is there a "right" way to do inheritance in JavaScript? If so, what is it?

I have been trying to learn how to add testing to existing code -- currently reading reading Working Effectively With Legacy Code. I have been trying to apply some of the principles in JavaScript, and now I'm trying to extract an interface. In searching for creating interfaces in JavaScript, I can't find a lot -- and what I find about ...

iframe shimming or ie6 (and below) select z-index bug

uhm im not sure if anyone has encountered this problem a brief description is on IE6 any <select> objects get displayed over any other item, even div's... meaning if you have a fancy javascript effect that displays a div that's supposed to be on top of everything (e.g: lightbox, multibox etc..) onclick of a certain element and that div ...

Books on animation, recommendations?

I would like to better understand the math behind animations, 3d and 2d. I recently came across this example via Digg. http://maettig.com/code/javascript/3d_dots.html It is pretty interesting and another animation experiment on the same site is just as impressive. http://maettig.com/code/javascript/swirl.html With FF 3.1 and WebKit-b...