Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we assign an object in Java Script??

For Example:-
-----------
If i create an object "obj1"
var obj1 = Object();
obj1.name = "hari";

and if i want to assign it to two objects "obj2" and "obj3"
with different names...

obj1.name = "gopi"
obj2 = new Object(obj1);

obj1.name = "raghu"
obj3 = new Object(obj1)

Now ob2.name become to "raghu" from "gopi". WHY?
how to solve the above problem?

Answer Posted / sandesh magdum

var obj1 = Object();
obj1.name = "hari";

obj1.name = "gopi";
obj2 = new Object(obj1);

//preserving name property of obj2 through obj4
var obj4=new Object();
obj4.name=obj2.name;

obj1.name = "raghu";
obj3 = new Object(obj1);

obj2=new Object(obj4);
alert("obj2 name="+obj2.name+" obj3 name="+obj3.name)

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to use multiple scriptmanager controls on a web page? : asp.net ajax

992


Do ajax applications always deliver a better experience than traditional web applications?

1086


What is the xmlhttprequest object?

1021


What are the real web applications of ajax currently running in the market?

1914


Explain the step property of the numericupdownextender control? : asp.net ajax

916


How do I handle the back and forward buttons?

999


What do I need to know to create my own ajax functionality?

987


Briefly describe asp.net ajax framework? : asp.net ajax

977


What are the components of the asp.net ajax architecture? : asp.net ajax

1004


What are ajax extensions?

1035


Define json?

992


What's the difference in HTML AJAX, ASP.Net AJAX?

2491


Are there any security issues with ajax?

983


What is an ajax request and what is a simple example of where a ajax request would be used?

958


What is the syntax to create ajax objects? : asp.net ajax

1028