GetElementById("ta") does not update with change in <textarea id=ta> and visa versa

While this works in IE I just cant get it to work in Firefox. Any changes in the textarea are not passed on when you click the ‘doit’ button and the ‘addTxt’ button only works once. How can I get the ‘doit’ button to display the text entered into the textarea?

    <script type="text/javascript">
    function addTxt(){
      document.getElementById("ta").innerHTML = 'Some New Text';
      document.getElementById("p1").innerHTML = '';
    function doit(){
        var txt = document.getElementById("ta").innerHTML;
        document.getElementById("p1").innerHTML = txt;
    <input type="button" value="addTxt" onclick="addTxt()">
    <textarea name="ta" id="ta" rows="2" cols="15">Txt</textarea>
    <input type="button" value="doit" onclick="doit()">
    <p name="p1" id="p1"></p>

Thanks for any help. I have been experimenting with all kinds of variations but just cant get it to work. Is there some way of refreshing the textarea element without having to refresh the whole page?

Why not use document.getElementById("ta").value = 'Some New Text' and
var txt = document.getElementById("ta").value etc instead?

.innerHTML is non-standard, while .value is in the DOM spec.

Thanks a lot! That seems to work - although only if I use .value on the textarea. The .value on “p1” does not work:
works: document.getElementById(“ta”).value = ‘Some New Text’;
works: document.getElementById(“p1”).innerHTML = ‘’;
does not work: document.getElementById(“p1”).value = ‘’;

ta is a textarea and has a value attribute ('cos it’s part of a form).
p1 is a paragraph, and does not have a value.

So for ta you want to use .value and for p1 .innerHTML.

^ What Immerse said.

To further clarify what the others have said, only form controls (INPUT, BUTTON, TEXTAREA) can have “value” attributes.