Regards, Murugavel S murugavel.sadagopan@gmail.com http://murugavelmsc.blogspot.in/
var man = new Object();man.name = 'Vikas Ahlawat';man.living = true;man.age = 27;
Mark as Answer if it helps you Thanks&Regards Aswini Aluri
<script>/*Employee-------- Fields: Id NameEmployeeCollection------------------- Fields: indexer count Functions: Add Delete Display*///This Function is used to create the collection object.//Copy this function to create your own collection objects.function CreateCollection(ClassName) { var obj=new Array(); eval("var t=new "+ClassName+"()"); for(_item in t) { eval("obj."+_item+"=t."+_item); } return obj;} function EmployeeCollection(){ this.Container=""; this.Add=function(obj) { this.push(obj); } this.Display=function() { str="<Table border=1 width=200 ><tr><td>" + "<b>Name</b></td><td><b>" + "Age</b></td><tr>"; for(i=0;i<this.length;i++) str+="<Tr><Td>"+this[i].Name+ "</Td><Td>"+this[i].Age+ "</Td></Tr>"; str+="</Table>"; this.Container.innerHTML=str; }} function Employee(Name,Age){ this.Name=Name; this.Age=Age;} //Using the EmployeeCollection and Employee ObejctsempCollection=new CreateCollection("EmployeeCollection"); empCollection.Add(new Employee("Jax",26));empCollection.Add(new Employee("Shionk",45));empCollection.Add(new Employee("Maya",25));empCollection.Container=document.getElementById("grid");alert(empCollection[0].Name);empCollection.Display();</script>
Mark This Response as Answer -- Chandu http://www.dotnetfunda.com/images/dnfmvp.gif
Login to post response