Blogger supports scripted forms:
2009-10-19
2009-10-11
Javascript object functions runs on creation
Consider the code bellow:
The function myfunction is used as a class for the object f, and is also executed at creation time.
The code produces this result:
| function myfunction(){ document.write("I was executed."); } var f = new myfunction(); |
The function myfunction is used as a class for the object f, and is also executed at creation time.
The code produces this result:
Static variable in a Javascript object function
Consider the code bellow:
| function myfunction(){ var myvariable=19.21; this.mymethod = function(){ return myvariable; }; this.increase = function(amount){ myvariable+=amount; }; } var f = new myfunction(); document.write("initial value is " + f.mymethod()); f.increase(0.80); document.write("<br/>new value is " + f.mymethod()); |
Because the function myfunction is used as a class for the object f, the local variable myvariable is considered private and it can be accessed only by member functions like mymethod and increase. Therefore this code produces something like this:
2009-10-10
Test Java Presence
To detect if Java is enabled on your computer use the following code:
if(navigator.javaEnabled()){ ... }
Therefore you on your computer.
if(navigator.javaEnabled()){ ... }
Therefore you on your computer.
Abonați-vă la:
Postări (Atom)



