Web Programming Training By OM SIR Call for free Demo :9320957717/18

JAVA-SCRIPT OBJECT

(19)Simple Object    Example   :

<script> 
                emp={id:102,name:"Shyam Kumar",salary:40000} 
                document.write(emp.id+" "+emp.name+" "+emp.salary); 
                </script> 





 (20)object using new keyword:

<script> 
var emp=new Object(); 
emp.id=101; 
emp.name="Ravi Malik"; 
emp.salary=50000; 
document.write(emp.id+" "+emp.name+" "+emp.salary); 
</script>

(21)Object  Constructor example:
                <script> 
                function emp(id,name,salary){ 
                this.id=id; 
                this.name=name; 
                this.salary=salary; 
                } 
                e=new emp(103,"Vimal Jaiswal",30000); 
                document.write(e.id+" "+e.name+" "+e.salary); 
                </script>

Previous
Next Post »