<script type="text/javascript">
function test(n)
{
n1 = n+1;
var n2 = n+2;
this.n3 = n+3;
test.n4 = n+4;
this.type = function()
{
document.write("n:",n," n1:",n1," n2:",n2,"<br>");
document.write("this.n3:",this.n3," test.n4:",test.n4,"<br>");
document.write(test.n3,"<br>");
document.write(this.n4,"<br>");
}
}
function print()
{
document.write("<br>--function print--<br>");
document.write("n1:",n1," test.n4:",test.n4,"<br>");
document.write("this.n3:",this.n3,"<br>");
document.write("n2:",n2,"<br>");
}
</script>
</head>
<body>
<h1>Javascript の Class の領域</h1>
<script type="text/javascript">
var cls = new test(10);
cls.type();
print();
</script>
|