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

How do we get the xmlhttprequest object in ajax?

928


How do we handle concurrent ajax requests?

922


Why does html_ajax hang on some server installs?

857


What is the basic goals of AJAX ?

1004


Would we be able to settle the updatepanel controls?

840


Why do you use ajax?

916


Is ajax considered a programming language?

906


Can ajax technology work on web servers other than iis?

1447


Explain differences between the page execution lifecycle of an asp.net page and an asp.net ajax page?

961


What will happen with click of browser "back" button among asynchronous requests?

859


Which two methods are used for handling cross-domain ajax calls ?

904


What are the different ways to pass parameters to the server? : asp.net ajax

978


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

895


How to create an ajax website using visual studio?

911


What are the tools for debugging ajax applications?

991