Question 1:
Does anybody know how to make a constructor function that creates objects that can be accessed like an Array object?
like:
And have an alert box pop up saying "name"
Question 2:
Is it possible to have a variable pointing specifically to an object's property?
Example, if you set the variable top to point to myDiv.style.pixelTop:
And it alerts "3px".
Question 3:
Javascript properties. No, not the normal properties, but more similar to the built-in properties. For instance, in IE, when you set a Div's
to a number, its
also changes and its position changes. This points to the idea that it calls a function when you change a property through the = operator. Is it possible in normal Javascript to call a function when changing object properties? It would be very useful.
Question 4:
function. Is it possible to create functions like it?
Keep in mind that the syntax to call typeof is:
This means that it is called using syntax other than is normal functions. Making functions like that would be equally useful.
Question 5:
. Why does the browser give me errors when I say
? Example:
The error is:
Kind of strange...
Thanks for helping.
Does anybody know how to make a constructor function that creates objects that can be accessed like an Array object?
like:
Code:
function specialObject() {
[What do I put here?]
}
var myArray=new specialObject('my','name','is','whatever');
alert(myArray[1]);
Question 2:
Is it possible to have a variable pointing specifically to an object's property?
Example, if you set the variable top to point to myDiv.style.pixelTop:
Code:
top=3;
alert(myDiv.style.top)
Question 3:
Javascript properties. No, not the normal properties, but more similar to the built-in properties. For instance, in IE, when you set a Div's
Code:
style.pixelTop
Code:
style.top
Question 4:
Code:
typeof
Keep in mind that the syntax to call typeof is:
Code:
typeof [variable]
Question 5:
Code:
in
Code:
in
Code:
var in='hey there';
Code:
Error: Expected Identifier
Thanks for helping.