not able to output value : JavaScript
<p>i am trying to enter a number in the textbox and show the message as name of the day in another div tag via switch function. the variable i am passing into switch function has to get the value from the textbox. but i am not able to output the function on clicking button, it shows the message "undefined".
Help please :).  Thank you</p>

<pre><code>&lt;input type = "text" id = "test" /&gt;
&lt;br&gt;
&lt;div id="box3" style = "border:solid 2px blue; height:15px;width:100px;"&gt;&lt;/div&gt;
&lt;br&gt;
&lt;input type = "button" onClick = "myTest()" value = "Click me" /&gt;

&lt;script type="text/javascript"&gt;
function myTest(){
var x;
var d =document.getElementById('test').value;
switch (d)
{
case 0:
x="Today it's Sunday";
break;
case 1:
x="Today it's Monday";
break;
case 2:
x="Today it's Tuesday";
break;
case 3:
x="Today it's Wednesday";
break;
case 4:
x="Today it's Thursday";
break;
case 5:
x="Today it's Friday";
break;
case 6:
x="Today it's Saturday";
break;
}
document.getElementById('box3').innerHTML=x;
}

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