Output values from Textbox using Constructor - Prototype
<p>i am trying to output the inserted values in the textboxes when the button(John) is click. At the moment i have just added default values
in here ( John= new Player(30,"England",3)); but i would like these value to be picked from the textboxes. Please advise how would i go about doing it.
I tried getting the values from textboxes and assigning to variables (x,y,z  commented out in script)and passing here ( John= new Player(x,y,z));
but it didn't seem to work.</p>

<pre><code>Age : &lt;input type = "text" id = "test1" /&gt;&lt;br&gt;
County : &lt;input type = "text" id = "test2" /&gt;&lt;br&gt;
Rank: &lt;input type = "text" id = "test3" /&gt;&lt;br&gt;

&lt;button type="button" onclick="John.myPlayer()"&gt;John&lt;/button&gt;

&lt;br&gt;

&lt;br&gt;
&lt;div id = "box"&gt;&lt;/div&gt;
&lt;br&gt;



&lt;script type="text/javascript"&gt;

// var x = document.getElementById('test1').value;
// var y = document.getElementById('test2').value;
// var z = document.getElementById('test3').value);

function Player(a,c,r){
this.age=a;
this.country=c;
this.rank=r;
}

Player.prototype.myPlayer = function(){

document.getElementById('box').innerHTML = "John is from " + this.country + " he is       " + this.age + " years old and his rank is " + this.rank;

}

John= new Player(30,"England",3);

John.myPlayer()


&lt;/script&gt;
</code></pre>
