There are two popular closure styles in javascript. The first I call anonymous constructor:
new function() {
var code...
}
and the inline executed function:
(function() {
var code...
})();
are there differences in behaviour between those two? Is one "better" over the other?...
I'm creating a web application on Google App Engine for fun and I'd like to include graphs so users can see some stats. Are there any free (either as in beer or speech) JavaScript libraries that can take a table or make some AJAX call and display a graph?
...
There are a few ways to get class-like behaviour in javascript, the most common seem to be prototype based like this:
function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this;}Vector.prototype.length = function () { return Math.sqrt(this.x * this.x ... ); }
and closure based approaches similar to
function...
I'm aware of things like "onchange", "onmousedown" and "onmouseup" but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover?...
Lately I find myself frequently creating singletons using the module pattern:
var singleton = (function(){
var _privateVariable = {};
var _privateMethod = function() {};
return {
publicVariable: {},
publicMethod: function() {}
}
})();
What is/are you favorite pattern/s for maintainable JavaScript?
...
I have been using PHP and Javascript for building my dads website. He wants to incorporate a login system into his website. I have the design for the login system using PHP, my problem is how do I show buttons if the person is logged in.
For Example - You have Home, Products, About Us, and Contact. Well I want to have buttons for Dea...
Hi. I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. Does anyone know of any javascript code that can do a reasonable job with graph layout? These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a bi...
Currently, I don't really have a good method of debugging javascript in internet explorer and safari. In Firefox, you can use Firebug's Logging feature and Command Line functions. However, this doesn't help me when I move to other browsers.
...
I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.
Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatically resize if the text was c...
Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron. I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit.
So, my question is, is there a way to have some kind of process explorer, or...
Hello, I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client...). but the web page isn't very important, and they don't care very much.
The mail created by the mailto action has the syntax:
subject: undefined su...
Hi,
I have an asp.net page with an asp:button that is not visible. I cant turn it visible with javascript because its not rendered to the page. What are my alternatives to solve this?
Thanks in advance,
Artur
...
I just saw this mentioned in this thread and didn't know it could be done. I'm a VS newbie, so how do you do it? Is there a separate debugger for Javascript? I know how to work the one for code-behind pages... I usually use Firebug to deal with debugging JS.
EDIT: I'm using VS 2005.
...
Question for YUI experts...
I have a table and I've made each cell of the first row draggable by proxy. In IE, when the drag proxy is released, the original table cell actually jumps to wherever the release point was. How can I prevent this from happening? Essentially, I want to know where the proxy was dropped and handle my logic from ...
I'm thinking that the reason I can't do this is because it might be a huge security hole, but here goes...
I want to have a bookmark on my browser (FF3, preferably) that is only a snippet of javascript code. It would merely construct a URL based on the current date and then do a window.location = on that URL.
I know that I could make ...
I would like to filter an array of items by using the map() function. Here is a code snippet:
var filteredItems = items.map(function(item)
{
if( ...some condition... )
{
return item;
}
});
The problem is that filtered out items still uses space in the array and I would like to completely wipe them out.
Any idea?
...
I'm having trouble with events in Internet Explorer 7
When I have a form with TWO+ input[type=text] and I press Enter key the events occurs in this order:
submit button, onClick
form, onSubmit
Sample code:
<FORM onSubmit="{alert('form::onSubmit'); return false;}">
<INPUT TYPE="text">
<INPUT TYPE="text">
<INPUT TYPE="submit" onCl...
Simple asp.net application.
I have two drop down controls, on the first drop down I have a javascript onChange event. The javascript enables the second drop down and removes a value from it (the value selected in the first drop down). If they click the blank first value of the dropdown, then the second drop down will be disabled (and th...
In my asp.net User Control I'm adding some script to the window.onload event like so:
if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName))
Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName,
"window.onload = function() {myFunction();};", true);
My problem is, if t...
I've asked this question to the forums on the Mootools website and one person said that my class selection was corrupted before an admin came along and changed my post status to invalid. Needless to say this did not help much. I then posted to a google group for mootools with no response. My question is why doesn't the 'enter', 'leave...