<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
< head >
< title > Untitled Page </ title >
< script language =javascript type ="text/javascript" > ...
function a()
...{
Object.prototype.haha="mahuia";
var s=new String();
window.alert(s.haha);
}
function RegNamespace(name)
...{
var ss= name.split(".");
var last=" new Object();";
var name="";
for(i=0;i<ss.length;i++)
...{
if (i>0)
...{
name+=".";
name+=ss[i];
}
else
name=ss[i];
eval(name+"="+last);
}
}
function returnfirt()
...{
return this.first;
}
function returnlast()
...{
return this.last;
}
function returnString()
...{
return this.first+" "+this.last;
}
function main()
...{
RegNamespace("bingo.exam");
bingo.exam.Student= function Student(s,j)
...{
this.first=s;
this.last=j;
this.getFirstName=returnfirt;
this.getLastName=returnlast;
this.toString=returnString;
}
var student = new bingo.exam.Student("Jim", "Green");
window.alert(student.getFirstName());
window.alert(student.getLastName());
window.alert(student);
}
</ script >
</ head >
< body onload =" main()" >
</ body >
</ html >
< head >
< title > Untitled Page </ title >
< script language =javascript type ="text/javascript" > ...
function a()
...{
Object.prototype.haha="mahuia";
var s=new String();
window.alert(s.haha);
}
function RegNamespace(name)
...{
var ss= name.split(".");
var last=" new Object();";
var name="";
for(i=0;i<ss.length;i++)
...{
if (i>0)
...{
name+=".";
name+=ss[i];
}
else
name=ss[i];
eval(name+"="+last);
}
}
function returnfirt()
...{
return this.first;
}
function returnlast()
...{
return this.last;
}
function returnString()
...{
return this.first+" "+this.last;
}
function main()
...{
RegNamespace("bingo.exam");
bingo.exam.Student= function Student(s,j)
...{
this.first=s;
this.last=j;
this.getFirstName=returnfirt;
this.getLastName=returnlast;
this.toString=returnString;
}
var student = new bingo.exam.Student("Jim", "Green");
window.alert(student.getFirstName());
window.alert(student.getLastName());
window.alert(student);
}
</ script >
</ head >
< body onload =" main()" >
</ body >
</ html >