If you mess around with JavaScript and forms a lot, or even just a little, you might come across needing to use the new Option() bit of code to create new options for a select box. I've noticed with this constructor a very strange thing: It's an object.
alert(typeof Option);
The above code will...
Would anyone happen to know whether you can use a Constructor function to create an Object that you can access just like a normal function?
function myConstructor() {
// code
}
myObject=new myConstructor;
myObject();
Ever wondered why, when declaring an event handler, you must not have the parentheses?
So have I. This is what I suspect is the reason behind it:
There's a difference between events in HTML and events in pure JavaScript. When you say as a tag's attribute:
onclick="alert('I\'ve been...
Is it possible to tell Apache to use as its default directory a page retrieved from another server over HTTP?
The thing is, I'm on a local network. My router, a Windows XP machine (192.168.0.15), doesn't seem to want to use my own computer (..0.17 -- Win 2k) as its HTTP server. Furthermore, my...
Question 1:
Does anybody know how to make a constructor function that creates objects that can be accessed like an Array object?
like:
function specialObject() {
[What do I put here?]
}
var myArray=new specialObject('my','name','is','whatever');
alert(myArray[1]);
And have an alert box pop up...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.