Q:

How to make text from an input box readable from javascript?

I'm making a html JAVASCRIPT turtle website, how would I be able to make text from a text input box a variable and accessible from javascript? And I want it so when I change the text inside the text box that when I click OK it send the new text and not the old one.
<input type="text" value="Put a number here"/>

A:

HTML
<input type="text" id="theTextBox"/>
<input type="button" id="theButton" value="Ok" onclick="theButtonClick()"/>

JavaScript
function theButtonClick()
{
    var theVariable = document.getElementById("theTextBox").value;
    alert(theVariable);
}

Try it out here.

