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

Describe the animation extender control and the method by which this control is utilized?

889


What is synchronous request in ajax?

855


Easy trough that the classical web applications are harder to make than ajax applications?

858


Is the asp.net ajax control toolkit(ajaxcontroltoolkit.dll) installed in the global assembly cache?

860


What do I do on the server to interact with an ajax client?

968


What is the role of scriptmanager in ajax?

861


Will html_ajax integrate with other javascript ajax libraries such as scriptaculous? How would this integration look like?

906


What are the tools for debugging ajax applications?

943


How does html_ajax compare with the xajax project at sourceforge?

863


What kinds of applications is ajax best suited for?

890


What is ajax used for?

838


What is the name of the dll that contains the ajax control toolkit?

877


What are asp.net ajax 4.0 validation controls?

846


What are the types of send() method used for xmlhttprequest?

879


How do I access data from other domains to create a mashup with java?

1014