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?
Answers were Sorted based on User's Feedback
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 |
Answer / rajesh
I maynot give the exact reason..but root cause may be
because of...
As you know the javascript is just parsed from top to
bottom. It won;t execute as long as you run the app.
While parsing it just holds the reference and checks for
syntactical errors.
| Is This Answer Correct ? | 0 Yes | 1 No |
The components in the asp.net 2.0 ajax packaging?
Some of the google examples you cite don't use xml at all. Do I have to use xml and/or xslt in an ajax application?
Cannot parse xml generated by jsp I am generating an xml using jsp, when I run the jsp in ie it shows the xml as per dom, but when I try to parse it using javascript , the command xmldoc.documentelement ?
How do we abort the current xmlhttprequest in ajax?
Do I really need to learn javascript before ajax?
What is ajaxcontrol toolkit?
What javascript libraries and frameworks are available?
Is the asp.net ajax control toolkit(ajaxcontroltoolkit.dll) installed in the global assembly cache?
Is it true that the ajax application are much better than the classical internet applications?
Is ajax just another name for xmlhttprequest?
What are the security issues with ajax?
How ajax is different?