In this code :
function myType(string){
this.string = string;
this.getName = function(){
//return this.name;
}
}
var myVar = new myType("string");
If I use myVar.getName(), it should return myVar. I need it to create a pop-up box that changes the whole <body> of the page, so it is important for me to get this function.
How can I do so?
Edit :
What I'm trying to do is to write a custom object. This is the steps :
- The user creates a object with a string;
- I define the functions :
(1) call() : It calls the inline pop-up box, which changes the whole body part of the page to the pop-up box; It saves the current body inthis.document_content.
(2) hide() : It change the body tothis.document_contentusingdocument.body.innerHTML. - The user call by using `[Variable Name].call();"
- The user can close the pop-up box by clicking a
<a>button in it.
The problem that I found is in 2(1), which I cannot get the name of variable to put it in the code in onclick.
What can I do?