Friday, October 28, 2011

The Importance of Online Backup Service

Internet and computer flexibility are certainly beneficial thing that will benefit the users greatly. However, all things have their positive sides as well as the negatives. When talking about the benefits, of course, there’re many things to mention. The easiness to connect to other users as well as flexibility to work over internet and online system is just one of the many good things offered by today’s technology. Nevertheless, the negative sides of being vulnerable and being easily attacked is also bigger and greater. In fact, if people aren’t always careful and watch their back, they will constantly have problems with their computers and their system.

That’s why the computer experts have also come with updated solutions and systems. Now there’s the so called backup system that is also working through online ways. This online backup system is the new protection system so people won’t have to be confused when something is happening to their system. With such online backup service, people can be relax to find out that their important data will be save and sound. They will always the backup so when the data is gone, they won’t have to be hysterical or panicky. There’re many kind of online backup blog that is offering their service and assistance in handling their clients’ system. This kind of service being handled by the experts in this field who know what they’re doing. People now don’t have to worry about anything anymore.

Isn’t it always better to be cautious and careful about everything rather than being sorry? If people are able to do precautious steps and try to minimize the risks as minimum as possible, they can always save their precious information and data. Sure, they may have to spend a bit of money, but which way they choose? To loose their data or to spend a bit money to protect such thing?

Friday, February 26, 2010

Free domain for free hosting gofreeserve

hay guy's in this page I'll continue about Free domain for gofreeserve. Such as What I said just now on another page before if you can use free domain in gofreeserve such as co.cc , co.nr and without Advertising from them.. it's really free future for you.

Okay if you have not domains when you registered first, you can direct go to co.cc or co.nr for register free domain and than now I'll show you how to configuration your free domain with gofreeserve,

first, you have to Log in to you gofreeserve account.


Than Click -> Addon Domains -> type your domain name -> Add Domain




automatically gofreeserve will create folder in File manager, Let's Go to Online File Manager
click folder with name your domain -> than htdocs

upload your website file in htdocs folder
eg. xims.co.cc/htdocs

okay, don't forget when you register in co.cc .
you have to configuration also there, from first page go to Name server, than fill

Name Server 1 : ns1.gofreeserve.com
Name Server 2 : ns2.gofreeserve.com

Okay, that's all are you ready with your site?
don't forget to always visit Hosting and Domains info

I say thanks to blogger master id in 100master

Free Hosting gofreeserve

Hay guys, now time to sharing about free hosting from gofreeserve, Now I have finished review form there. and now it's time to share free hosting service form gofreeserve. Okay let's

Free Web Hosting Account Features :

- Account Control Panel
Their hosting platform uses the powerful vistapanel control panel. This fully featured control panel system allows you to control your account and provides a portal for managing all domain names and hosting with your account. Easily and effectively manage email, domains, databases, FTP, software installation and much more from one easy to use graphical interface.


- Website Builder
Building a website is now easier than ever, Their website building tool is a great value added feature that allows you to select a design template and build your entire website online within minutes. The user-friendly website builder is an ideal introduction for beginners to create and publish stunning websites very easily from the large collection of templates available without having to know HTML.


- Automatic Script Installer
The Fantastico Type Installer automates the installation of common web scripts such as CMS, forums, blogs and more. It's so easy to use that even novice web developers can install a new forum for their website with a few clicks of the mouse. A process which can take 15 minutes to an hour depending on your connection is reduced to a minute or two thanks to the powerful and easy to utilize script installer.


- MySQL Database Management
Their provide you with the tools to create and manage your databases. To administer MySQL databases you can use phpMyAdmin which is included within the control panel allowing you to carry out many different operations with MySQL to manage effectively. Also integrated is the slow MySQL query tool to pinpoint slow SQL code in MySQL, this information can help resolve performance problems to speed up your MySQL queries.


- Multi Domain Hosting
Create multiple domains / websites on the same account which gives you far more flexibility to utilize your web hosting space. With this feature you can host an additional number of domains and sub domains that are totally independent web sites all sharing the same control panel. You can also park additional domain names to your hosting account allowing you to access one web site with two different names.


wow... Very Wonderful, But Wait... I have more Information
Do you know how much you will get Storage ? 1000 MB for Free
Do you know how much you will get free bandwidth ? 40960 Mb for free
Do you know how much you will get free SQL space database ? 50 Mb for free +PHP Support

Do You want Info more ? Okay Let's Continue . .
it's about FREE DOMAIN , you will use free domain in your free account such as co.cc and co.nr Okay more describe about Free Domain for gofreeserve I will Describe Letter in Next Page about free domains for free hosting gofreeserve

Still Wait in Hosting And Domains info
I say thanks to blogger master ID in 100master

Seo List Free Directory PR3

Hello Guys,  Did you know what I want to share know?
Humm.. Bellow is List Free Directory For you These directory have PR3, okay Let's Go Submit your site Now

www.wilridge.com

www.uraputki.org

www.timbenderhats.com

www.thewindingsheet.com

www.talkers.ws

www.rukhnama.com

www.netnodder.com

www.nadrealizem

www.mzyon.net

www.linkspecialists.info

www.linkspecialist.info

www.linkspecial.info

www.linkspawn.info

www.linkspanner.info

www.linkspa.info

www.linksower.info

www.linksow.info

www.linksought.info

www.linksorters.info

www.inlivecaffe.com

www.free-directory.ws

www.business-resource.biz

www.shadowshow.net

Ha... are you happy now ? Okay give comment in ShoutMix Chat Box

SEO Submit Site To Search Engines

Hii guys, I got this article form Mater Shaun Anderson. now I want to share this article for you, Okay Let's Begin.

Firts. check your website or your blog in search Engine
How Do I Check If My Site Is In Google?
Just type your website address in the Google search box. If Google knows about your site, it will tell you. If your website doesn’t come up as a result, you need to submit your site to Google. Another way to check if a page is in either of the search engines is to lift a piece of unique text from the page, put it in a search “in quotes”.Your page should come up.

Second. if you not found your site
How Do You Submit A Site To Search Engines?

You do not need a SEO agency to submit your site to Google. You don’t pay to get into any of the big search engines. As I have said many times in the past, the best way to actually get into Google and the other top search engines is for the search engine spider to find your site through a link that is already on another website which Google already has in it’s index. A link from a blog, forum or other website. Any link will do as long as Google sees it as a link. For example, if you have a web design company, join a web design forum that allows you to put a link to your website in a signature. When it comes to links, think how relevant the page is your wanting the link from to your website. Many think relevant links are very important.

You could of course think about submitting your site to directories like Yahoo or (if you can stand to wait years if you are unlucky) DMOZ or asking other sites in your niche to link to you.

But if you are very lazy, you could just tell the search engines about your site. Not that I ever recommend this sort of thing:

 

    JavaScript Creating time delays

    Hey guys, Meet with me again, okay let's we continue with Java Script creating time delays
    There are two ways of creating time delays with JavaScript. The first is more simple and will simply wait for a specified amount of time before executing a function. The second does the same but will repeatedly execute the function.

    Note, most browsers have a minimum delay length of between 25 and 75 ms. If a shorter delay is specified, the actual delay will be the minimum delay length. Even with higher numbers, the delay is never perfect. Most browsers will take slightly longer than the time you ask for, typically just a few miliseconds error. Some may correct their errors over time with interval timers. Also note, setting many timers with short delays on one page will cause the browser to become slow and somewhat unresponsive. Three or four timers is usually the reliable limit.

    setTimeout

    The first method uses a window method called setTimeout(). The method waits for a specified number of milliseconds then executes the specified code. The code can either be a direct reference to a function, or it can be a string that will be evaluated as if it contained source code.

    window.setTimeout(referenceToFunction,timeInMilliseconds);

    window.setTimeout('runMoreCode()',timeInMilliseconds);
     
    Wherever possible, you should use a direct function reference as it is much more efficient. Using a string requires the browser to create a new script environment so it can process the script.

    If you create a timeout, the code after the call to setTimeout will continue to run as normal. After the specified delay, the timeout will start a new thread, and the code specified in the call to setTimeout will be run in the new thread, along side any code that is still running in the initial thread. Unlike with many more complex languages, JavaScript does not offer any way to control when those threads sleep, wake, or yield. The JavaScript engine handles all of that, and you must accept that your new thread could be executing at any time next to another thread. Many JavaScript engines will simply allow one thread to complete before allowing the other thread to start. The same applies to events, which run in their own threads, and can be triggered at any time.

    To pass variables to a timeout, you can use either format. To use a string, it is necessary to make sure the variables you want to pass can be represented in one of the primitive data types, and do not contain any characters that will break the string format (such as quotes). If possible, you should avoid this format, but this is an example, just in case you need to:

    window.setTimeout
    ('runMoreCode(\''+someString+'\','+someNumber+')',10);
     
    window.setTimeout('runMoreCode()',timeInMilliseconds);
     
    Wherever possible, you should use a direct function reference as it is much more efficient. Using a string requires the browser to create a new script environment so it can process the script.

    If you create a timeout, the code after the call to setTimeout will continue to run as normal. After the specified delay, the timeout will start a new thread, and the code specified in the call to setTimeout will be run in the new thread, along side any code that is still running in the initial thread. Unlike with many more complex languages, JavaScript does not offer any way to control when those threads sleep, wake, or yield. The JavaScript engine handles all of that, and you must accept that your new thread could be executing at any time next to another thread. Many JavaScript engines will simply allow one thread to complete before allowing the other thread to start. The same applies to events, which run in their own threads, and can be triggered at any time.

    To pass variables to a timeout, you can use either format. To use a string, it is necessary to make sure the variables you want to pass can be represented in one of the primitive data types, and do not contain any characters that will break the string format (such as quotes). If possible, you should avoid this format, but this is an example, just in case you need to:
      
    window.setTimeout
    ('runMoreCode(\''+someString+'\','+someNumber+')',10); 
     
    The direct function reference is much more easy, as you can pass variables as extra setTimeout method. In addition to being more easy, it is also able to accept any type of variable.Be careful with browsers that use the Mozilla Gecko engine (such as
    Firefox and Netscape 6+)as they will always pass an extra parameter to the function - the number of miliseconds error. This example uses an inline anonymous function, and is equivalent to using a direct function reference:

     
    window.setTimeout(function (a,b) {
      //do something with a and b
    },10,someString,someObject); 
    
    
    The variables that are passed to the function will be the values held by the variables at the time that the method was called. For example, assume you had a variable called myVar and it contained the number 5.
    You then called a timeout, passing it the variable myVar, and set it for a delay of 1 second. Immediately you change the value of  myVar to 7. When the timeout fires,it will run the function, and pass
    it the number 5, since that was the value myVar contained when you
    called the function.

    setInterval


    The setInterval method is identical in syntax to setTimeout(). The difference is that as well as firing after the specified delay, it will fire again after the same delay, and will continue to fire at the specified interval until it is cancelled.

    window.setInterval(function (a,b) {
      //do something with a and b
    },10,someString,someObject);

    Clearing timeouts and intervals


    You can cancel a timeout or interval by calling the relevant clearTimeout or clearInterval method, passing it a reference to the interval object. The code specified in the timer will not be run. In this example, an interval timer will be set to fire once every second (it will perform a useless task of incrementing a number, just as an example), and a timeout will be set to cancel the interval after 3.5 seconds:

    var myInterval = window.setInterval(function (a,b) {
      myNumber++;
    },1000);
    window.setTimeout(function (a,b) {
      clearInterval(myInterval);
    },3500);

    You can obtain the timeout object in the same way as shown here for the interval, and you can cancel it in the same way, using clearTimeout.

    Tuesday, February 23, 2010

    JavaScript Creating objects

    Any function in JavaScript can be used to create custom object classes, simply by calling it using the keyword new. When called in this way, the special variable this inside the function references the new object that is being constructed (it normally refers to the 'current' object, which is usually window, except inside methods). The function should not return a value. The following function can be used as demonstrated to create an object of class myobject:

    function myobject() {
      this.containedValue = 0;
      this.othercontainedValue = 0;
      this.anothercontainedValue = 0;
    }
    
    var mything = new myobject();
     
    And there you go, mything is now an instance of class myobject. It will have the following properties, all of which will be 0: 

    -  mything.containedValue 
    -  mything.othercontainedValue 
    -  mything.anothercontainedValue

    You could also now write this:

    myobject.prototype.newContainedValue = someValue;
     
    This will cause all instances of class myobject will have the property newContainedValue with value someValue.
    Use the instanceof operator to find out if your object is an instance of a given object class:

    
    
    if( myvar instanceof Array ) { ... }
    if( myvar instanceof myobject ) { ... }
     

    Creating an object with methods

    Now I will give you an example showing you how to create methods for your objects. As an example, I will create a circle as my object. The methods will be
    nameOfCircle.retArea()
    Returns the area of the circle (pi r2)
    nameOfCircle.retCirc()
    Returns the circumference of the circle (2 pi r)
    nameOfCircle.mvBy(xDis,yDis)
    Moves the circle by xDis in the x direction and yDis in the y direction
    The following lines point the methods to functions that the object will use as the methods: 

    -  this.retArea = getTheArea; 
    -  this.mvBy = mvCclBy; 
    -  this.retCirc = function () { ... };

    The third of these defines the method using an anonymous function in one line, and does not work in some early Netscape 4 releases. Note, it has a semicolon after the '}', and is one of the few places where this is correct practice.


    function mycircle(x,y,r) {
      this.xcoord = x;
      this.ycoord = y;
      this.radius = r;
      this.retArea = getTheArea;
      //This next line uses an alternative syntax
      this.retCirc = function () 
    { return ( Math.PI * this.radius * 2 ); };
      this.mvBy = mvCclBy;
    }
    function getTheArea() {
      return ( Math.PI * this.radius * this.radius );
    }
    function mvCclBy(xDis,yDis) {
      this.xcoord += xDis;
      this.ycoord += yDis;
    }
    
    /*
    create a mycircle called testcircle where testcircle.xcoord is 3
    and testcircle.ycoord is 4 and testcircle.radius is 5
    */
    var testcircle = new mycircle(3,4,5);
    /*
    use the mvBy method to displace the centre of testcircle.
    move it by 2 in the x direction and 3 in the y direction
    */
    testcircle.mvBy(2,3);
    //testcircle.xcoord is now 5 and testcircle.ycoord is now 7
    
    window.alert( 'The area of the circle is ' + testcircle.retArea() 
    );
    window.alert( 'The circumference is ' + testcircle.retCirc() );
     

    The special 'toString' method

    All objects have the 'toString' method, even if you do not define it yourself. The method returns a string representation of the object, and is automatically called whenever a string representation of an object is required, such as when you use alert(myObject);
    In most browsers, this returns '[object Object]', although some more useful browsers return a string like this:

    '{property1:value1,property2:value2,method1:function () 
    { ... },etc.}'

    However, for your own objects, you may wish to provide a special string that may provide more useful information. To do this, simply define the 'toString' method:

    this.toString = function () {
      return 'Circle object; xcoord: ' + this.xcoord + ', ycoord: '+
        this.ycoord + ', radius: ' + this.radius;
    };
     
     

    Advanced object techniques


    These deal with concepts that are rarely used in JavaScripting. JavaScript is 
    a more powerful programming language than most people make use of, 
    but that is because in normal scripting, these powerful features are not really 
    necessary. If you are just learning
     
    Some of these techniques may not work in older browsers like early Netscape 
    4 releases.

    Adding extra properties/methods using prototype


    Take the mycircle example from the top of this section (creating new objects). We have already created an instance of the mycircle class called 'testcircle'. And we can also assume that we have created a few other mycircles. Now, let us assume that we want to add another property to each circle. For example, we want each circle to have a 'texture' property. We could use this:

    testcircle.texture = 'smooth';
     
    And we could do this for each individual mycircle. But since we want to do this for all of them, it would be much more easy to give all instances the property at the same time. So we can use the 'prototype' property of the class constructor:

    mycircle.prototype.texture = 'smooth';
     
    Immediately, all of the mycircles that we have created will now 
    inherit the new property: 
     
    alert(testcircle.texture);
    //alerts 'smooth'
     
    We can add new methods the same way:
     
    mycircle.prototype.setArea = function (oArea) {
      this.radius = Math.sqrt( oArea / Math.PI );
    };
    mycircle.setArea(5);  
     
    This is most useful with instrinsic (fundamental inbuilt) objects. For example,
    the regular expression construct /a[0-9]b/g is shorthand for new  
    RegExp('a[0-9]b','g'); and in fact the same is true for all intrinsic 
    object classes, such as String, Number and Boolean. So if, for example, 
    we wanted to create a new method on all strings called 'reverse' that 
    returned their contents in reverse order, we could do this: 
     
    String.prototype.reverse = function() {
      for( var oStr = '', x = this.length - 1, oTmp; 
        oTmp = this.charAt(x); x-- ) {
        oStr += oTmp;
      }
      return oStr;
    }; 
    
    
    The use of prototype could have been applied to create all of the methods of 
    the mycircle object, not just new ones. This gives a mixed response to 
    performance. It will not have to store individual copies of the methods for each 
    instance of the object, so it may require less memory, but it will require the 
    browser to search the current and parent scopes to find the methods. This may 
    cause a marginal delay. Generally, you should use what is appropriate for 
    your code, and not base this decision on performance (unless you are dealing 
    with a very specific controlled environment):
     
    function mycircle(x,y,r) {
      this.xcoord = x;
      this.ycoord = y;
      this.radius = r;
    }
    mycircle.prototype.retArea = function () {
      return ( Math.PI * this.radius * this.radius );
    };
    mycircle.prototype.retCirc = function () {
      return ( Math.PI * this.radius * 2 );
    };
    mycircle.prototype.mvBy = function (xDis,yDis) {
      this.xcoord += xDis;
      this.ycoord += yDis;
    }; 
    In some cases, it may be desirable to work out if a property on an object is 
    attached to the object instance itself, or somewhere in its prototype chain. 
    In JavaScript, all objects have a method called hasOwnProperty
    that returns true if the given property is attached to the individual object 
    instance. Of course, it is also possible to check if the object's constructor 
    also has the same property with the same value as the object instance itself, 
    but that can give the wrong result if separate properties exists with the same 
    value on both the object instance and the prototype chain. 
    The hasOwnProperty method accepts a single parameter; the name of the 
    property as a string.
     
    function myclass() {
      this.propertytwo = 2;
      this.propertythree = 3;
    }
    myclass.prototype.propertyone = 1;
    myclass.prototype.propertytwo = 2;
    
    var myinstance = new myclass();
    myinstance.propertyfour = 4;
    
    alert(myinstance.hasOwnProperty('propertyone'));
    //alerts false
    
    alert(myinstance.hasOwnProperty('propertytwo'));
    //alerts true
    
    alert(myinstance.hasOwnProperty('propertythree'));
    //alerts true
    
    alert(myinstance.hasOwnProperty('propertyfour'));
    //alerts true
    
    alert(myinstance.hasOwnProperty('propertyfive'));
    //alerts false 

    Public and private properties

    This is a concept that is almost never used in JavaScript, and there is a good reason. It simply is not necessary. Even complicated scripts are almost never complex enough to require this level of control. However, many programmers familiar with other programming languages (such as Java or C++) often desire this behavior in JavaScript simply because it is a concept they are familiar with. This sort of concept is only really useful when putting together large projects from multiple pieces of code.
    Say for example that I am producing a public functions library. A set of constructors and methods that people can include in their own projects (something that Java programmers use all of the time). Say for example that the mycircle constructor is included in it, so that you can create your own mycircles. Now say for example you try this:

    var aCircle = new mycircle(5,6,'about 3mm'); 

    That will work now (it's not a valid measurement, but my constructor will not argue), but later on when you try to use the methods that my class provides, it will fail. So I can check what you have provided, and make sure it is a valid number, and use a default value if it is not. But then you can say something like this:
    aCircle.radius = 'some text';
     
    Again, it would break (of course, it is your own fault, but in more complicated 
    applications, it would be possible to make a mistake where this causes 
    a real problem). So what I want to do is to not allow you to modify that 
    property directly, and only allow you to change it using a method that I control:
    
    
    this.setRadius = function (oRad) {
      if( typeof(oRad) == 'number' && oRad >= 0 ) {
        this.radius = oRad;
      } else {
        this.radius = 0;
      }
    };
    
    
    An alternative situation where this can be important is if I am storing the information in one set of properties. I then upgrade my libraries, maybe adding some extra functionality. But in order to do so, I have to change the properties that I am using. If your script was relying on them existing in a specific format, and I have now changed that format, your script would fail. If I could protect those properties, and force you to use only methods, then I could do whatever I needed with the properties, and as long as I then change the methods to use the new properties, your script would keep working, and you would not even need to know what I had changed or why. That way, we could each manage our own project, and not waste each other's time.

    It would also help avoid possible conflicts between undisclosed properties, and your own scripting. For example, if you decide to temporarily assign a property to an object, but you were unaware that internally, my object constructor already used that property name, you would overwrite my object's property, and cause problems with the object.

    This is what private properties are for. They do not allow scripts that use the contructor to use or modify the properties directly. They only allow the methods of the object itself to use and modify them. Unlike many other languages, JavaScript does not declare each variable type as 'public' or 'private'. It all depends on how you create them.

    Saying 'this.propertyname' as I did above will create a public property. Any script can create an object then use and modify its properties directly. Using 'var' to define a variable in the constructor will create a private property. Note that unlike public properties, the private properties are then accessed, including from within methods, without the 'this.' prefix - just like a normal variable. This makes heavy use of JavaScript's scope functionality. Private variables can only be accessed from methods that are declared inline, and not externally referenced or created using the prototype construct. Methods of this kind are also known as privileged methods. An example of its use might be: this.mymethod = function () { alert( propertyname ); };

    function myob() {
      this.property1 = 'value1'; //this creates a public property
      var property2 = 'value2';  //this creates a private property
      this.method1 = function () { alert( property2 ); };
    }
    var oneOb = new myob();
    alert(oneOb.property1); //alerts 'value1'
    alert(oneOb.property2); //alerts undefined (private property)
    oneOb.method1();        //alerts 'value2'
     
    Similarly, you can also create private methods. These are simply a function that 
    you create inside the constructor function. This may look confusing, but it works. 
    The private function can only be called by the constructor itself, or by methods 
    that are defined inline. Private methods can be used as public methods, 
    if they are assigned to a public method constructor, and accessed using 
    the public method constructor (as with 'method2' below). 
     
    function myob() {
      function cantBeSeen() {
        alert(secretValue);
      }
      var secretValue = '';
      this.method1 = function () {
        secretValue = 'no surprises';
        cantBeSeen();
      };
      this.method2 = cantBeSeen;
    }
    var oneOb = new myob();
    oneOb.method1(); //alerts 'no surprises'
    oneOb.method2(); //alerts 'no surprises' 
    
    

    Sub-classes and class inheritance

    This is also hardly ever used in JavaScript, despite its popularity in other languages. Take this as an example. I want to make a new type of object, that will store the data to represent a sphere (a ball - in case you don't know). Since a sphere is just a three dimensional circle, I would probably want to include all the methods I created earlier for the circle object; retArea to get the cross-section area, retCirc to get the circumference, mvBy to move it by a certain amount. Aditionally, I would probably want retVol to get the volume, and retSurf to get the surface area. I would also need to provide a z coordinate when creating the object, and again when calling the mvBy property.

    So, I want to create a new type of object, based on the mycircle, but with a few aditions and modifications. I will call this new type of object a mysphere. Now, I could just rewrite all the code I already wrote for the mycircle and change the bits I need. But in a real-world application, this might be a lot of wasteful duplication, for only one or two modifications. So what I want to do is make the mysphere inherit all the properties and methods of the mycircle, then overwrite only the ones I want.

    This effectively makes mysphere a sub-class of mycircle, and making the mysphere class constructor inherit from the mycircle class constructor is as simple as this:

    function mysphere(x,y,z,r) { ... constructor code ... }
    mysphere.prototype = new mycircle();
     
    In case you are wondering, the way it works is to actually create a mycircle, 
    then assign that to the mysphere constructor prototype. As a result, 
    the mysphere constructor has the mycircle object added to its prototype 
    chain. What this means is that each time a mysphere is created, it will inherit 
    the properties and methods of  the mycircle object. It can then override any 
    of these properties using its own prototype, or with properties and methods 
    created within its own constructor. If any of these properties are subsequently 
    removed (using the 'delete' keyword), the inherited ones will become available 
    again. That also means that if the mycircle prototype is changed 
    (properties are added or deleted, etc.), these changes are replicated down 
    the chain, so the mysphere also inherits these changes. 
     
    Note that the prototype chain is established for each object as the object is created. Once an object has been created, its prototype chain cannot be changed (though new properties and methods can still be added to its parent classes, and those changes will be reflected in the object). Changes to its prototype chain will have no effect; it will still see the old prototype chain. The new chain will only be used for new instances of that class. This is also the case for the assignment of a new mycircle to the prototype of mysphere (which, as stated, creates a new instance of the mycircle class); any subsequent changes to the prototype chain of the mycircle class will not be reflected in the mysphere class. For this reason, it is very important to ensure that the prototype chain is built in the correct order, with class constructors and their prototypes set up before any child class is made to inherit from them. Properties and methods can still be added to any class or parent class at any time after their own prototype chain has been set up.

    The line that makes mysphere inherit from mycircle sounds simple enough. And at least, it would be, but you will remember that mycircle expected me to pass it some parameters that it would then use. Then I call my new constructor, and these parameters will not automatically be passed to the mycircle constructor function. I need to do this myself for each mysphere that I want to create. But since I am not passing these parameters when assigning the mycircle object to the mysphere prototype, I also need to ensure that the mycircle contructor stops before attempting to create its own properties. Instead of defining the public properties immediately, I will define them using a method (that I have decided to call getready), and if the required parameters have been passed (arguments.length), I will immediately call the method.

    If the parameters are present, the mycircle constructor keeps working, and no-one needs to know that anything was changed at all. To make things easier later on, I will take all of the methods out of the constructor, and add them later using the prototype. That way, the mycircle prototype methods will always be available without me needing to create a new mycircle. Unfortunately, this also means that public and private properties are very hard (or impossible) to use. It's a trade off - one functionality for another.
     
    function mycircle(x,y,r) {
      if( arguments.length ) { this.getready(x,y,r); }
    }
    mycircle.prototype.getready = function (a,b,c) {
      this.xcoord = a;
      this.ycoord = b;
      this.radius = c;
    };
    mycircle.prototype.retArea = function () {
      return ( Math.PI * this.radius * this.radius );
    };
    mycircle.prototype.retCirc = function () {
      return ( Math.PI * this.radius * 2 );
    };
    mycircle.prototype.mvBy = function (xDis,yDis) {
      this.xcoord += xDis; this.ycoord += yDis;
    }; 
    
    
    
    
    Now, back to the mysphere constructor. I have already said how to make it inherit, but it still needs to run the mycircle.getready method to initialise the properties. To do this, we will need to reference the parent class prototype, and run the method ourselves. This also ensures that even if each parent class uses the same method name (getready), the correct one is always referenced. Since we can almost never be sure how many sub-classes we will need, it is useful to do it this way, and simply use the same method name for each, knowing that we will not have problems with name conflicts.

    When running the method, we need to tell JavaScript that even though we are referencing a method for a different prototype, we want to run it as if it were a method of the object we are creating (to make sure that any properties it creates are added to the object we are creating). This could be done using the 'call' method or 'apply' method, but unfortunately, Internet Explorer 5 does not understand these, so I will assign it to a temporary property of the new object, and run it from there.

    To reference the method from the parent class prototype, it would be possible to use the constructor's prototype chain to locate it (the property that references the constructor will, at this point, refer to the parent class - more on that later):

    this.constructor.getready

    However, that will only work for one level of inheritance, due to the way it is run as a method of the current object for all child classes. As a result, it is best to reference it by name, which will work no matter how many levels of class inheritance are used:

    mycircle.prototype.getready
     
    Note that when assigning the mycircle object to the mysphere prototype, 
    it also overwrites the mysphere prototype constructor  property. This is 
    not a major problem, but some scripts use it, so we will put 
    the reference back where we want it:
     
    function mysphere(x,y,z,r) {
      if( arguments.length ) { this.getready(x,y,z,r); }
    }
    //inherit from the mycircle prototype
    mysphere.prototype = new mycircle();
    //put the correct constructor reference back (not essential)
    mysphere.prototype.constructor = mysphere;
    
    mysphere.prototype.getready = function (a,b,c,d) {
      //reference the getready method from the parent class
      this.tempReady = mycircle.prototype.getready;
      //and run it as if it were part of this object
      this.tempReady(a,b,d);
      //now that all required properties have been inherited
      //from the parent class, define extra ones from this class
      this.zcoord = c;
    }
    mysphere.prototype.mvBy = function (xDis,yDis,zDis) {
      //override the existing method
      this.xcoord += xDis;
      this.ycoord += yDis;
      this.zcoord += zDis;
    };
    mysphere.prototype.retVol = function () {
      return ( 4 / 3 ) * Math.PI * Math.pow( this.radius, 3 );
    };
    mysphere.prototype.retSurf = function () {
      return 4 * Math.PI * this.radius * this.radius;
    }; 
     
    And finally, to use it:
     
    var testsphere = new mysphere(3,4,5,6);
    
    alert( 'The cross-section area is ' + testsphere.retArea() );
    alert( 'The circumference is ' + testsphere.retCirc() );
    alert( 'The volume is ' + testsphere.retVol() );
    alert( 'The surface area is ' + testsphere.retSurf() ); 
     
     
    There is no limit to how many sub-classes can inherit from a class,
    and there is also no limit to how many levels of sub-classes can 
    be created. As an example, I will create a ball class that will 
    inherit from the mysphere class: 
    
    
    function ball(x,y,z,r,m) {
      if( arguments.length ) { this.getready(x,y,z,r,m); }
    }
    ball.prototype = new mysphere();
    ball.prototype.constructor = ball;
    
    ball.prototype.getready = function (a,b,c,d,e) {
      this.tempReady = mysphere.prototype.getready;
      this.tempReady(a,b,c,d);
      this.mass = e;
    }
    ball.prototype.retDensity = function () {
      return this.mass / this.retVol();
    }; 
     
     
     
    The instanceof operator returns true when testing an object against any class 
    in its prototype chain, so it would say that an instance of the ball class was 
    also an instance of the mysphere class, and also the  mycircle class.