I am trying to make this script working with a prompt that ask the user which object (screen, location, window) property will show.
If I use this code it will works with this:

Propriedades

Propriedad Valor
availWidth = 1280
availHeight = 800
availTop = 0
availLeft = 0
pixelDepth = 24
colorDepth = 24
width = 1280
height = 800

Code:
<body>
<h2>Propriedades</h2>
<table id="tabla">
<tr><th> Propriedad </th><th> Valor </th></tr>
</table>

<script type="text/javascript">



var i, tabla = document.getElementById("tabla");
for (i in screen){
    tabla.innerHTML += "<tr><td>"+i+" </td><td> = " +screen[i]+ "</td></tr>";
}
</script>

</body>

But If I ask which name with a prompt, then the output is wrong, why? Please Help me! Thanks.


Propriedades

Propriedad Valor
0 = s
1 = c
2 = r
3 = e
4 = e
5 = n

Code:
<body>
<h2>Propriedades</h2>
<table id="tabla">
<tr><th> Propriedad </th><th> Valor </th></tr>
</table>

<script type="text/javascript">

name=prompt("¿Que propriedad quiere?");

var i, tabla = document.getElementById("tabla");
for (i in name){
    tabla.innerHTML += "<tr><td>"+i+" </td><td> = " +name[i]+ "</td></tr>";
}
</script>

</body>